/ src / util / serfloat.h
serfloat.h
 1  // Copyright (c) 2021-present The Bitcoin Core developers
 2  // Distributed under the MIT software license, see the accompanying
 3  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
 4  
 5  #ifndef BITCOIN_UTIL_SERFLOAT_H
 6  #define BITCOIN_UTIL_SERFLOAT_H
 7  
 8  #include <cstdint>
 9  
10  /* Encode a double using the IEEE 754 binary64 format. All NaNs are encoded as x86/ARM's
11   * positive quiet NaN with payload 0. */
12  uint64_t EncodeDouble(double f) noexcept;
13  /* Reverse operation of DecodeDouble. DecodeDouble(EncodeDouble(f))==f unless isnan(f). */
14  double DecodeDouble(uint64_t v) noexcept;
15  
16  #endif // BITCOIN_UTIL_SERFLOAT_H