Number accuracy

Post Reply
User avatar
Dutchman
Posts: 858
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Number accuracy

Post by Dutchman »

George said in viewtopic.php?f=20&t=1732
Our manual is still wrong. We are able to do 2^53, not 2^52.
To be sure I made the following test:

Code: Select all

'Number accuracy
n=2^53
n$="2^53"
print n$&"=";"#":n,"= HEX"&"""0"&HEX$(n)&""""
print "-"&n$&"=";"#":-n
print n$&"-1=";"#":n-1,"= HEX"&"""0"&HEX$(n-1)&""""
PRINT "Wrong result:"
'The following gives wrong result
print n$&"+1=";"#":n+1,"= HEX"&"""0"&HEX$(n+1)&""""
with the following output:
output.PNG
output.PNG (66.66 KiB) Viewed 1939 times
I corrected the manual. Thanks George ;)
Last edited by Dutchman on Fri Jan 20, 2023 12:13 pm, edited 1 time in total.

User avatar
GeorgeMcGinn
Posts: 435
Joined: Sat Sep 10, 2016 6:37 am
My devices: IPad Pro 10.5in
IMac
Linux i386
Windows 7 & 10
Location: Venice, FL
Flag: United States of America
Contact:

Re: Number accuracy

Post by GeorgeMcGinn »

Thanks.

It was so long ago I wasn't sure where we left off on this, until it was brought up again by sarossell.

After digging through my old paper long hand and redid the testing including multpying and division (I never did the +1 or -1 tests) my initial thought that I put in my programs were also wrong. I was using the 2^52 instead of the 2^53.

I could only find half of the posts, but I saved the document that Mr. K. told me about that would make interesting reading and I did read it and came to the conclusion that it should be 2^53.

Sorry io bring this up again, but I too wanted to make sure when I put it in my programmer's guide that it not only matches what you had, but that we both agreed on which was right.

Thanks for looking into this again and I'm glad it's settled or solved.

Now if we can get the string format conversion to binary (which is why I started looking at one of my favorite resources, http://www.simotime.com/asc2ebc1.htm#AscEbcTables, maybe we can have a function to give us the kind of precision needed for larger numbers.

Thanks Ton,

George.
Dutchman wrote:
Tue Jan 17, 2017 2:14 pm
George said in viewtopic.php?f=20&t=1732
Our manual is still wrong. We are able to do 2^53, not 2^52.
To be sure I made the following test:

Code: Select all

'Number accuracy
n=2^53
n$="2^53"
print n$&"=";"#":n,"= HEX"&"""0"&HEX$(n)&""""
print "-"&n$&"=";"#":-n
print n$&"-1=";"#":n-1,"= HEX"&"""0"&HEX$(n-1)&""""
PRINT "Wrong result:"
'The following gives wrong result
print n$&"+1=";"#":n+1,"= HEX"&"""0"&HEX$(n+1)&""""
with the following output:
output.PNG

I corrected the manual. Thanks George ;)
George McGinn
Computer Scientist/Cosmologist/Writer/Photographer
Member: IEEE, IEEE Computer Society
IEEE Sensors Council & IoT Technical Community
American Association for the Advancement of Science (AAAS)

User avatar
Mr. Kibernetik
Site Admin
Posts: 4787
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Number accuracy

Post by Mr. Kibernetik »


Post Reply