I'm not a C programmer,

So let me restate my question, provided perl is compiled with other settings. (FP32,FP64,FP80,FP128, etc?)

Will F return another bitlength? ¹

Citing the docs

f A single-precision float in native format. d A double-precision float in native format. F A Perl internal floating-point value (NV) in native format D A float of long-double precision in native format. (Long doubles are available only if your system supports long double values. Raises an exception otherwise. +(* WRONG see demo) Note that there are different long double formats.)

What I read - and can't test² - is that F will produce f,d or D according to the setting.

D will fail* if not internally available, but f and d will coerce° accordingly.

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

If I'm wrong, don't you think perldocs of packtut and pack should clarify this?

update 1

1)

From our previous discussion:

> > > There's no way to know if F is an IEEE double or not.

> > I'm confused, I'm expecting F to return 32, 64, 80 or 128 bits (at least)

IEEE double means FP64, 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)

update 2

²) well lets try

*) wrong °)seems to be true

main::(-e:1): 0 DB<1> say unpack "B*", pack "f", 1/3 10101011101010101010101000111110 DB<2> say unpack "B*", pack "d", 1/3 0101010101010101010101010101010101010101010101011101010100111111 DB<3> say unpack "B*", pack "F", 1/3 0101010101010101010101010101010101010101010101011101010100111111 DB<4> say unpack "B*", pack "D", 1/3 0000000010101000101010101010101010101010101010101010101010101010111111 +0100111111000000000000000000000000000000000000000000000000 DB<5> use warnings; say unpack "B*", pack "D", 1/3 # NO EXCE +PTION RAISED 0000000010101000101010101010101010101010101010101010101010101010111111 +0100111111000000000000000000000000000000000000000000000000

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

³) According to Wikipedia is "64-extended" only loosely defined as having 79+ bits


In reply to Re^8: Introspection into floats/NV by LanX
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.