![]() |
![]() |
![]() |
GLib Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
Numerical DefinitionsNumerical Definitions — mathematical constants, and floating point decomposition |
#include <glib.h> #define G_IEEE754_FLOAT_BIAS #define G_IEEE754_DOUBLE_BIAS union GFloatIEEE754; union GDoubleIEEE754; #define G_E #define G_LN2 #define G_LN10 #define G_PI #define G_PI_2 #define G_PI_4 #define G_SQRT2 #define G_LOG_2_BASE_10
GLib offers mathematical constants such as G_PI for the value of pi; many platforms have these in the C library, but some don't, the GLib versions always exist.
The GFloatIEEE754 and GDoubleIEEE754 unions are used to access the sign, mantissa and exponent of IEEE floats and doubles. These unions are defined as appropriate for a given platform. IEEE floats and doubles are supported (used for storage) by at least Intel, PPC and Sparc. See IEEE 754-2008 for more information about IEEE number formats.
#define G_IEEE754_FLOAT_BIAS
The bias by which exponents in single-precision floats are offset.
#define G_IEEE754_DOUBLE_BIAS
The bias by which exponents in double-precision floats are offset.
The GFloatIEEE754 and GDoubleIEEE754 unions are used to access the sign, mantissa and exponent of IEEE floats and doubles. These unions are defined as appropriate for a given platform. IEEE floats and doubles are supported (used for storage) by at least Intel, PPC and Sparc.
The GFloatIEEE754 and GDoubleIEEE754 unions are used to access the sign, mantissa and exponent of IEEE floats and doubles. These unions are defined as appropriate for a given platform. IEEE floats and doubles are supported (used for storage) by at least Intel, PPC and Sparc.