in reply to Re: Introspection into floats/NV
in thread Introspection into floats/NV

Thanks, the second unpack is a good workaround! :)

printf "%a" should hopefully handle all edge cases.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^3: Introspection into floats/NV
by ikegami (Patriarch) on Jun 03, 2025 at 16:32 UTC

    I wrote this before %a was introduced. But %a produces scientific notation, whereas the above doesn't.

      > But %a produces scientific notation, whereas the above doesn't.

      my issue with %a is rather that it's called "hex float" but the exponent is decimal ... LOL.

      I'm happy that it exists anyway, since different builds can have other floats configured, plattforms have various endianness too.

      Furthermore it's a valid number format in Perl.

      DB<18> say 0x1p+10 - 1 1023

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      see Wikisyntax for the Monastery

        I was using it to find the periodic portion.

        0.1 = 0.00011001100110011001100110011001100110011001100110011010 ____ = 0.00011