|
ATLAS Offline Software
|
Go to the documentation of this file.
16 #ifndef CXXUTILS_FLOATPACKER_H
17 #define CXXUTILS_FLOATPACKER_H
77 bool is_signed =
true,
145 #endif // not CXXUTILS_FLOATPACKER_H
FloatPacker(int nbits, int nmantissa, double scale=1, bool is_signed=true, bool round=false)
Constructor.
float round(const float toRound, const unsigned int decimals)
bool m_is_signed
Should we use a sign bit?
Packdest m_npack_ones
Mask with that many low bits set.
Packdest m_signmask
Mask containing the sign bit (or 0 if there's no sign bit).
int m_min_exp
Minimum exponent value.
int m_nexp
Number of exponent bits.
bool m_round
Should we round instead of truncating?
uint32_t Packdest
Type into which we pack.
Packdest pack(double src, std::string *err=nullptr) const
Pack a value.
int m_max_exp
Maximum exponent value.
int m_nmantissa
Number of bits in the mantissa + sign bit.
Packdest m_nexp_ones
Mask with that many low bits set.
double unpack(Packdest val, std::string *err=nullptr) const
Unpack the value VAL.
double m_invscale
Inverse of scale.
Pack/unpack floating-point data from/to a given number of bits.
int m_npack
Number of bits in mantissa (exclusive of any sign bit).
double m_scale
Scale factor for stored numbers.