Error calculation is a little more complex then that. And you're NOT supposed to round off untill the end, but carry as many significant figures as you have in the intermediate calculations untill you report it to the user. THEN you apply the error calculation (that is in the 90% of the cases more complicated then the calculation itself) and display the final result:
1.2 +/- 0.0000000001
Incidentally, most pocket calculators will make the same round-off errors:
2/0.99999999 = 2
etc.
Greg
-----Original Message-----
From: Jeff Fisher [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 20, 2002 4:56 AM
To: JDJList
Subject: [jdjlist] Re: Double multiplication
According to what I was taught in college, your answer is only good to the
least significant digit. In otherwords if one variable has two decimal
places and the other has five, your answer will only be accurate to two
decimal places.
-----Original Message-----
From: Mark E. Zawadzki [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 20, 2002 7:51 AM
To: JDJList
Subject: [jdjlist] Re: Double multiplication
Agreed - and as a scientific programmer, a bit of advice - if you have a lot
of numbers to the
right of the decimal point - you are are most likely using the wrong units.
--- Joseph Ottinger <[EMAIL PROTECTED]> wrote:
> Why do I detect a "Java is slow" post in your future? :) As usual, when
> you're doing floating point on binary systems, you always have to figure
out
> if it's *really* important to have the precision... and usually, it isn't.
>
> I'm sure at this point, people are finding woodwork to crawl out of
saying,
> "Yes, it is!" - and you're all correct, for you it's important because
> you're rocket scientists and all that, and maybe even a financial
programmer
> or two are finding graves to spin in as well. However... I'd still stand
by
> the statement that in most cases, the accuracy simply isn't important
enough
> to justify crippling your program's speed. It's all about the tradeoffs.
If
> it's all about what you SEE, then format the numbers going out instead.
>
> >From: "Ivan Bradac" <[EMAIL PROTECTED]>
> >Reply-To: "JDJList" <[EMAIL PROTECTED]>
> >To: "JDJList" <[EMAIL PROTECTED]>
> >Subject: [jdjlist] Re: Double multiplication
> >Date: Fri, 20 Sep 2002 09:34:01 +0200
> >
> >Hi all
> >
> >thanks for all your answers. I will try to switch to BigDecimal.
>
> -----------------------------------------------
> Joseph B. Ottinger [EMAIL PROTECTED]
> http://enigmastation.com IT Consultant
>
> _________________________________________________________________
> Join the world's largest e-mail service with MSN Hotmail.
> http://www.hotmail.com
>
>
> To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm
=====
Mark Zawadzki Performance Engineer/DBA/Programmer extraordinaire'
[EMAIL PROTECTED] [EMAIL PROTECTED]
"Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the universe trying to build
bigger and better idiots.
So far, the universe is winning"
Robert Cringle (columnist, author, host of "Triumph of the Nerds")
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm
To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm
To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm