> hexadecimal is just another representation format for the more abstract concept of an integer

minor nitpick, to my surprise it's now possible to define hexadecimal floats.

see perldata#Scalar-value-constructors

0x1.999ap-4         # hexadecimal floating point (the "p" is required)

couldn't test yet, seems to be newer than 5.16 :)

update

yep

DB<1> p $] 5.024001 DB<2> p 0x1.999Ap-4 0.100000381469727

Though not mentioned in perlnumber yet

update

seems to work, the exponent 4 counts to the power of 2 (NOT 16 or 256). (16**4 is there to move the fraction point)

DB<37> p 0x1999A /16**4 /2**4 0.100000381469727

And it becomes obvious why p was used since an E is a valid hex digit.

more testing

DB<49> eval qq{print 0x1p${_},"\n"} for -4..4 0.0625 0.125 0.25 0.5 1 2 4 8 16

Hex fraction point moves with each 4 power steps (since 16 == 2**4 )

DB<58> x 0x10 , 0x1.0p4 , 0x1.0p0 , 0x10p-4 0 16 1 16 2 1 3 1

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


In reply to Re^2: hexadecimal division (hexadecimal floating point -updated) by LanX
in thread hexadecimal division by holandes777

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.