Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^11: subtraction issue

by pryrt (Abbot)
on Jan 29, 2017 at 16:47 UTC ( [id://1180563]=note: print w/replies, xml ) Need Help??


in reply to Re^10: subtraction issue
in thread subtraction issue

yes, that's exactly where I was trying, rather ineffectually, to get to. Thank for finding that.

Replies are listed 'Best First'.
Re^12: subtraction issue
by pryrt (Abbot) on Jan 30, 2017 at 16:43 UTC

    ... As promised, my manual manipulation of FixedPoint (arbitrary length strings of digits) ...

    __RESULTS__ ------------------------------------------------------ ulp(1) = 0.0000000000000002220446049250313080847263336181640625 1+ulp(1) = 1.0000000000000002220446049250313080847263336181640625 ------------------------------------------------------ ---------------------------------------- (1+ulp(1))*2**-1022 = 0.00000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000002225073858507201877155878558578948240 +788008848683704195613130031211968860399600696529790429221262885863903 +701367028190801717129607271191035512722741317515219905574004313880456 +780323337753988163917738732895924607422927011307805381339708165336129 +644744952978952121897909078385258336590185178961879988515042751478263 +607602168043622031129270045483207396484571310391222596393560832244062 +389690727689018671705454927517398658932481040173822832825124579506565 +573819103800864691161582871998970864729322144979697154670672039979199 +080916034762598038599542473984767886118009507251154376238960371621517 +172981601154460435953128432540644193864532490538913779568091580479240 +509922741385427494262054264040883983691918741817298779334027924276754 +4565229087538682506419718265533447265625 FixedPoint: 1 = Digits before the fixed decimal point FixedPoint: 1074 = Total digits the fixed decimal point FixedPoint: 308 = Location of first significant digit (nt +h digit after decimal point) FixedPoint: 767 = Number of significant digits Double: 2.2250738585072019e-308 HexFloat: +0x1.0000000000001p-1022 DecFloat: +0d1.0000000000000002p-1022 Math: 308 = should start at ceil(-log10(x))-th digi +t after decimal point Math: 1074 = total number of digits after decimal sh +ould be the lowest power of two = ceil(-log2(ulp(x))) Math: 767 = Number of significant digits

    So what I said poorly as "it takes n fixed-point decimal digits to exactly represent an n-bit fixed-point fractional binary number" could have been better phrased: "if the smallest power of two exactly represented in a floating-point number is -n, it takes n decimal digits after the fixed decimal point to exactly represent that same number." In the example of nextUp(1), the smallest power of two is -52, so it takes 52 decimal digits after the fixed decimal point to exactly represent it. In the example of nextUp(POS_NORM_SMALLEST) = 2**-1022 + 2**-1074, it takes 1074 digits after the fixed decimal point to exactly represent it.

    Thanks for this interesting diversion.

    update: removed duplicate end-code tag

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1180563]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-24 12:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found