Hacker News new | comments | show | ask | jobs | submit login
Dumpfp: A Tool to Inspect Floating-Point Numbers (reverberate.org)
51 points by haberman on Nov 24, 2012 | hide | past | web | favorite | 9 comments

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.

Thanks 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).

Also note the output of %a can be used in C99 source code.

Nice work. This would be a great demo in a computer science class.

Thanks! It's something I always wished I had in previous moments when floating-point math was confounding me. I was finally inspired to sit down and write it when I saw this story a couple days ago on HN: http://news.ycombinator.com/item?id=4815399

Yeah. I agree. But one point to make: it would be great if this is integrated into a debugger. A way to mark codes for floating point inspection. One cpp file. Very clean.

Link to the Github repository, which is oddly missing from the post: https://github.com/haberman/dumpfp

It's linked, but my link color probably should be more obvious, sorry about that!

What about `od -f`

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact