On Tue, Jan 2, 2024 at 8:49 PM Alejandro Colomar <alx@xxxxxxxxxx> wrote: > The value of that macro is defined to be 2; it can't have any other > value. > > ISO C defines it in > <http://port70.net/~nsz/c/c11/n1570.html#5.2.4.2.2p11>. > > POSIX defines it in > <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/float.h.html>. > > Maybe the definition of frexp() by ISO C and POSIX should be changed to > define it in terms of FLT_RADIX instead of 2. > > Have a lovely day, > Alex Every version of ISO C says (emphasis mine): The values given in the following list shall be replaced by constant expressions with implementation-defined values that are *greater or equal* in magnitude (absolute value) to those shown, with the same sign: -- radix of exponent representation, b FLT_RADIX 2 And POSIX defines it similarly. So FLT_RADIX can be greater than 2 (unless the implementation defines __STDC_IEC_559__), it just can't be any less. Indeed, the subsequent EXAMPLE 1 in ISO C sets FLT_RADIX to 16. Thus, since frexp(3) is defined to return a power of 2, interpreting it as a power of FLT_RADIX is incorrect in the general case. Thank you, Matthew House