Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Country Specific / Australian Mac Group / May 2005



Tip: Looking for answers? Try searching our database.

calculator error?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter McCallum - 27 May 2005 09:03 GMT
When I use Calculator (v3.2.1) to do the following calculation:
9000 - 8387.7 - 557.3

I get the result:
54.999999999999

What gives?

Signature

Peter McCallum
Mackay Qld AUSTRALIA

Phil Wheeler - 27 May 2005 11:25 GMT
> When I use Calculator (v3.2.1) to do the following calculation:
> 9000 - 8387.7 - 557.3
>
> I get the result:
> 54.999999999999

Using v. 4.0 I get the same result.  But changing the precision from 12
to 16 gives a more pleasing result. And so does changing the precision
to 6.  A bit odd.
Geoff Welsh - 27 May 2005 17:59 GMT
>> When I use Calculator (v3.2.1) to do the following calculation:
>> 9000 - 8387.7 - 557.3
[quoted text clipped - 5 lines]
> to 16 gives a more pleasing result. And so does changing the precision
> to 6.  A bit odd.
I noticed that about a year ago when I first purchased OSX.  (Reminded
me of using Fortan in College.)
Anyway, changing the precision to 10 worked for me.
Thanks for the tip!
GW
Hans Aberg - 27 May 2005 12:59 GMT
> When I use Calculator (v3.2.1) to do the following calculation:
> 9000 - 8387.7 - 557.3
[quoted text clipped - 3 lines]
>
> What gives?

Most computers nowadays converts all floating point numbers into binary
form, and then performs operations on those. Thus, round-off errors might
occur.

You can get better precision in Terminal, by searching for calculator programs:
 man -k calculator
One such program is "bc". You can learn about it by typing "man bc". Then type:
 echo "9000 - 8387.7 - 557.3" | bc
 55.0
Here, the answer is merely a round-off of a higher precision result.

Signature

 Hans Aberg

Randy Howard - 28 May 2005 02:16 GMT
> When I use Calculator (v3.2.1) to do the following calculation:
> 9000 - 8387.7 - 557.3
[quoted text clipped - 3 lines]
>
> What gives?

http://docs.sun.com/source/806-3568/ncg_goldberg.html

Signature

Randy Howard (2reply remove FOOBAR)
"I don't really care about being right you know,
  I just care about success." --Steve Jobs

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.