3 ms·
printf("%a\n", f) may also be of interest. %a is C99-only so you need a relatively modern C library to use it, but it prints an exact hexadecimal representation
by makomk 14y ago
printf("%a\n", f) may also be of interest. %a is C99-only so you need a relatively modern C library to use it, but it prints an exact hexadecimal representation of a floating-point number if that's possible on your system.
- makira 14y agoAlso note the output of %a can be used in C99 source code.
- haberman 14y agoThanks for the info -- it looks like strto{d,f} can parse this format, so you could use it as input to dumpfp, making it the easiest way to get a precise value into it from another program (in case you don't want to link it in).