RE: Math Weirdness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2008-07-15 at 12:26 -0400, tedd wrote:
> At 4:52 PM +0100 7/15/08, Ford, Mike wrote:
> >On 15 July 2008 14:33, tedd advised:
> >  > Mike:
> >>
> >>  No reason to be rude.
> >>
> >>  I said:
> >>
> >>  "Round-off errors normally don't enter into things unless your doing
> >>  multiplication and division operations."
> >>
> >>  And that is not "Bull" -- it's true. You can add and subtract all the
> >>  floating point numbers (the one's we are talking about here) you want
> >>  without any rounding errors whatsoever.
> >
> >Sorry, I do apologise if I came over too strongly -- there was no
> >intention to offend.
> >
> >However, you really can't dismiss the effects of round-off errors on
> >addition and subtraction as lightly as that.  It's simply not true that
> >approximations only occur at the point of doing multiplication and
> >division -- there *are* approximations involved in addition and
> >subtraction, and it is necessary to be aware that this is the case -- as
> >Jay proved, 0.1+0.2 is hardly ever exactly 0.3. In this sort of case, it
> >may well be that an appropriate degree of suspicion is simply to round
> >to 2 decimal places at every stage, or compare the absolute difference
> >to .001, but nonetheless one has to *know* that this is necessary.
> >
> >Ummm -- sorry, better </rant>, now!!!
> 
> No problem about the rudeness -- email is a terrible form of 
> communication. Sometimes we don't realize how we are being perceived.
> 
> I know full well about what you speak and why there are problems 
> dealing with numbers.
> 
> My only point here was that the OP was talking about his 
> balance-sheet not balancing at the end of the day.
> 
> I said that if all he was doing was adding and subtracting, then he 
> wouldn't have any problems -- those operations are not subject to the 
> rounding errors that division and multiplication induce. And 
> experience has shown me that my claim is true. I can add and subtract 
> dollars and cents all day without an error whatsoever.
> 
> Now, if you get into more complicated math, such as 
> multiplication/division then of course rounding errors come into play 
> much more noticeably. It is true that not every number can be 
> represented in binary because of the limits of the processor. Take 
> for example pi, no computer in the world has capabilities to 
> represent that number in it's totality (i.e.,  unlimited precision).

Umm... here it is to unlimited precision: π

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux