Bitcoin Core 28.99.0
P2P Digital Currency
serfloat.h
Go to the documentation of this file.
1// Copyright (c) 2021-2022 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. */
12uint64_t EncodeDouble(double f) noexcept;
13/* Reverse operation of DecodeDouble. DecodeDouble(EncodeDouble(f))==f unless isnan(f). */
14double DecodeDouble(uint64_t v) noexcept;
15
16#endif // BITCOIN_UTIL_SERFLOAT_H
uint64_t EncodeDouble(double f) noexcept
Definition: serfloat.cpp:37
double DecodeDouble(uint64_t v) noexcept
Definition: serfloat.cpp:10