Idea to increase numeric accuracy in newLISP
Posted: Sat Sep 15, 2007 6:49 am
I use a 64-bit Linux distro, so this suggestion might not apply to all versions of newLISP.
I've written a very simple Reverse Polish Notation calculator in C. To store numbers, the data type I chose was "long double." With this, I am able to calculate large numbers such as 2^2048 (*). In newLISP, however, even with a 64-bit build, trying to calculate just 2^1024 returns "inf," and 2^1023 only returns "8.988465674e+307." Is it possible to enable use of "long double" on at least 64-bit builds?
(*) 2^2048 =
32317006071311007300714876688669951960444102669715484032130345427524655138867890
89319720141152291346368871796092189801949411955915049092109508815238644828312063
08773673009960917501977503896521067960576383840675682767922186426197561618380943
38476170470581645852036305042887575891541065808607552399123930385521914333389668
34242068497478656456949485617603532632205807780565933102619270846031415025859286
41771167259436037184618573575983511523016459044036976132332872312271256847108202
09725157101726931323469678542580656697935045997268352998638215525166389437335543
602135433229604645318478604952148193555853611059596230656
And my program happily computes up to 2^16383 (a 4301 digit number); at 2^16384 it returns "inf." I think it's safe to say that 2^16383 is a number that will not practically be needed for some time. In cryptography, however, 2^1024 is a relatively "low" number, so I think newLISP needs to address this issue.
I've written a very simple Reverse Polish Notation calculator in C. To store numbers, the data type I chose was "long double." With this, I am able to calculate large numbers such as 2^2048 (*). In newLISP, however, even with a 64-bit build, trying to calculate just 2^1024 returns "inf," and 2^1023 only returns "8.988465674e+307." Is it possible to enable use of "long double" on at least 64-bit builds?
(*) 2^2048 =
32317006071311007300714876688669951960444102669715484032130345427524655138867890
89319720141152291346368871796092189801949411955915049092109508815238644828312063
08773673009960917501977503896521067960576383840675682767922186426197561618380943
38476170470581645852036305042887575891541065808607552399123930385521914333389668
34242068497478656456949485617603532632205807780565933102619270846031415025859286
41771167259436037184618573575983511523016459044036976132332872312271256847108202
09725157101726931323469678542580656697935045997268352998638215525166389437335543
602135433229604645318478604952148193555853611059596230656
And my program happily computes up to 2^16383 (a 4301 digit number); at 2^16384 it returns "inf." I think it's safe to say that 2^16383 is a number that will not practically be needed for some time. In cryptography, however, 2^1024 is a relatively "low" number, so I think newLISP needs to address this issue.