Re: Tiny Challenge: significant digits Message #8 Posted by Oliver Unter Ecker on 17 Jan 2012, 6:14 p.m., in response to message #7 by Marcus von Cube, Germany
Marcus,
You mean BCD, right? ("Binary arithmetic" sounds like arithmetic with binary numbers...) Sadly, ND1 doesn't have a BCD option yet.
Reals are IEEE754 doubles in ND1. And the RPL programs above imply reals. (Unlike on the 50g in exact mode, where they imply BigInts. ND1 does have BigInt support, but I chose to not adopt the HP 50g convention (in exact mode only) to regard a decimal typed without a "dot" as a BigInt. Instead, if you want a BigInt, you have to use R>I (or toBig, in "modern" syntax).)
In the latest release BigFloats are supported, too.
So,
« 3 toBigF INV >NUM >STR TAIL SIZE »
will actually return whatever the BigFloat precision is set to (40 digits, by default).
To confirm that "1/3*3" is "1" in IEEE754, just type this in gdb:
p 1.0/3.0*3.0
Works for any integervalued double I tried.
Not bad for a format, for which 1.12 is 1.1200000000000001.
(Yes... I'm still yearning for including BCD at some point.)
EDIT: I educated myself and do understand now that with "binary arithmetic" you meant (and correctly termed) what to me is floatingpoint arithmetic. So, yes, ND1 is using binary arithmetic exclusively, for its Real data type.
Edited: 18 Jan 2012, 3:33 p.m.
