I'm not a C programmer

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.

Unfortunately, there is no mention of the FP80 format you mentioned in another thread.

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.

F will produce f,d or D according to the setting.

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:
pack formatC typeWhat it is
ffloatIEEE single
ddoubleIEEE double
Dlong doubleIEEE quad
FNV = __float80Intel 80-bit extended precision

It would be an unusual choice since __float80 is padded to 16 bytes, the same size as the also-supported IEEE quad.

Will F return another bitlength?

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.

if F returns different bit length it's possible to tell that it's not a FP64. It might be much trickier to tell if its according to IEEE though (i.e. position and format of sign and exponent)

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 reply to Re^9: Introspection into floats/NV by ikegami
in thread Introspection into floats/NV by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.