play and relax: games for kids games
  Cut the knot: learn to enjoy mathematics
A math books store at a unique math study site. Learn to enjoy mathematics.
Google
Web CTK
Best sites for teachers
Sites for teachers
Sites for parents
Terms of use
Awards

Interactive Activities
CTK Exchange
CTK Insights - a blog

Games & Puzzles
What Is What
Arithmetic/Algebra
Geometry
Probability
Outline Mathematics
Make an Identity
Book Reviews
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
Other Math sites
Front Page
Movie shortcuts
Personal info
Privacy Policy

Guest book
News sites

Recommend this site

Best sites for teachers
Sites for teachers
Sites for parents

Education & Parenting

Manifesto: what CTK is about Search CTK Buying a book is a commitment to learning Table of content Things you can find on CTK Chronology of updates Email to Cut The Knot Recommend this page

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

 

 

Copyright © 1996-2008 Alexander Bogomolny

29397586Page copy protected against web site content infringement by Copyscape


Search:
Keywords:


Latest on CTK Exchange
try this puzzle ?/?? + ?/?? + ?/? ...
Posted by albert1950
0 messages
07:05 AM, Jul-10-08

Monty Hall Problem
Posted by linkdon
71 messages
03:06 PM, Jul-18-08

Missing information
Posted by roboknight
2 messages
07:32 AM, Jun-22-08

Golden Number linked to 666
Posted by Titus
4 messages
02:53 PM, Jul-19-08

Mistake on the page (an aside, Be ...
Posted by Max
4 messages
10:28 AM, Feb-28-08

trisection of an angle
Posted by Pytheus
2 messages
06:39 AM, Jul-14-08

You can drill a square hole
Posted by Giorgis
1 messages
10:15 PM, Jul-12-08