http://www.perlmonks.org?node_id=11104692


in reply to Re^8: Defining an XS symbol in the Makefile.PL
in thread Defining an XS symbol in the Makefile.PL

Do the different long double types have differing ranges?

Yes, but we don't need to know anything about the range for the task at hand.
We just need to know the maximum number of bits of precision for each type, and the number of decimal digits required to accurately handle each of those maximum precisions.
That is:
53 bits needs 17 decimal digits
64 bits needs 21 decimal digits
113 bits needs 36 decimal digits

The DoubleDouble can actually accommodate some (not all) 2098-bit values - which would require 633 decimal digits, but I'm still pondering what should be done about that.
I doubt that"%.632" NVgf will produce reliable results anyway.
Unpacking the bytes of the NV is probably cheaper and quicker than obtaining a numeric value, so maybe that's a better path to take for *all* NVs - not just the DoubleDouble.

Cheers,
Rob