Subject: Base Calculator
Date: Fri, 16 Aug 96 20:01:00
From: Alex Bogomolny

Dear Matt,

please feel free to use my calculator any way you think fit. The behavior you describe is due to the limited size of the number representation used by JavaScript built-in functions. I look at the numbers you enter in the edit controls as 'long integers' that are most likely to be represented by 8 bytes or 64 bits. If a number requires more than that it will be truncated during its conversion from a string into an integer. Since truncated will be the most significant digits you not only lose accuracy but actually the meaning of the number.

To boot, the first bit is used to represent the sign - 1 for minus and 0 for plus. Which leaves us with 63 bits. This would imply that the largest hexadecimal integer correctly handled by the calculator is 0x7FFFFFFF which is 2147483647 decimal. I might have used what is called unsigned long integers which would have given 64 bit long numbers with the maximum of 0xFFFFFFFF and 4294967295 for hexadecimal and decimal representations respectively.

There is definitely a way to carry math operations with more precision. This requires a more substantial programming effort. The way the conversion is carried between different bases is described in most introductory books on Numerical Analysis.

Sincerely,
Alex

|Reply| |Up| |Exchange index| |Contents| |Store|

Copyright © 1996-2012 Alexander Bogomolny

 40614709

A math books store at a unique math study site. Shopping at the store helps maintain the site. Thank you.
Sites for teachers
Sites for parents
Terms of use
Awards
Interactive Activities

CTK Exchange
CTK Wiki Math
CTK Insights - a blog
Math Help
Games & Puzzles
What Is What
Arithmetic
Algebra
Geometry
Probability
Outline Mathematics
Make an Identity
Book Reviews
Stories for Young
Eye Opener
Analog Gadgets
Inventor's Paradox
Did you know?...
Proofs
Math as Language
Things Impossible
Visual Illusions
My Logo
Math Poll
Cut The Knot!
MSET99 Talk
Old and nice bookstore
Other Math sites
Front Page
Movie shortcuts
Personal info
Privacy Policy

Guest book
News sites

Recommend this site

Sites for parents

Education & Parenting

Search:
Keywords:

Google
Web CTK
Supported by
3wVentures