pastebin - collaborative debugging tool
rovema.kpaste.net RSS


C99 hexfloat %a vs %f precision
Posted by Anonymous on Thu 20th Jan 2022 12:08
raw | new post
modification of post by Anonymous (view diff)

  1. $ ksh93 -c 'float x ;  for (( x=1. ; x < 1.000001 ; x=nextafter(x,1000) )) ; do printf "%a\t%26.26f\n" x x ; done' | head -n 20
  2. 0x1.0000000000000000000000000000p+0     1.00000000000000000000000000
  3. 0x1.0000000000000002000000000000p+0     1.00000000000000000000000000
  4. 0x1.0000000000000004000000000000p+0     1.00000000000000000000000000
  5. 0x1.0000000000000006000000000000p+0     1.00000000000000000000000000
  6. 0x1.0000000000000008000000000000p+0     1.00000000000000000000000000
  7. 0x1.000000000000000a000000000000p+0     1.00000000000000000100000000
  8. 0x1.000000000000000c000000000000p+0     1.00000000000000000100000000
  9. 0x1.000000000000000e000000000000p+0     1.00000000000000000100000000
  10. 0x1.0000000000000010000000000000p+0     1.00000000000000000100000000
  11. 0x1.0000000000000012000000000000p+0     1.00000000000000000100000000
  12. 0x1.0000000000000014000000000000p+0     1.00000000000000000100000000
  13. 0x1.0000000000000016000000000000p+0     1.00000000000000000100000000
  14. 0x1.0000000000000018000000000000p+0     1.00000000000000000100000000
  15. 0x1.000000000000001a000000000000p+0     1.00000000000000000100000000
  16. 0x1.000000000000001c000000000000p+0     1.00000000000000000200000000
  17. 0x1.000000000000001e000000000000p+0     1.00000000000000000200000000
  18. 0x1.0000000000000020000000000000p+0     1.00000000000000000200000000
  19. 0x1.0000000000000022000000000000p+0     1.00000000000000000200000000
  20. 0x1.0000000000000024000000000000p+0     1.00000000000000000200000000
  21. 0x1.0000000000000026000000000000p+0     1.00000000000000000200000000

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at