![]() |
|
more useful options | |
PerlMonks |
Re^9: Introspection into floats/NVby ikegami (Patriarch) |
on Jun 05, 2025 at 14:35 UTC ( [id://11165272]=note: print w/replies, xml ) | Need Help?? |
C doesn't mandate the size or format of float, double or long double. Some or all of these might even be optional to implement.
Wikipedia's Extended_precision#x86_extended-precision_format says "The x86 extended-precision format is an 80-bit format first implemented in the Intel 8087 math coprocessor and is supported by all processors that are based on the x86 design that incorporate a floating-point unit (FPU)." gcc makes these available as __float80 on x86-64 machines.
NV (F) is user-defined, and it isn't limited to be one of float (f), double (d) or long double (D). For example, someone using gcc on a modern x86-64 (i.e. nearly everyone) could build a Perl with the following types:
It would be an unusual choice since __float80 is padded to 16 bytes, the same size as the also-supported IEEE quad.
It can. In that setup described, it would return the same byte length as D since __float80 is padded to 16 bytes, but it would be a different format that D.
Exactly. It's easy to tell that a (say) 10-byte format isn't an one of the IEEE formats, but distinguishing a __float80 from an IEEE quad is harder. Updated based on new knowledge of about the 80-bit floats.
In Section
Seekers of Perl Wisdom
|
|