RE: Math Weirdness

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

 



On 14 July 2008 20:47, tedd advised:

> Round-off errors normally don't enter into things unless your doing
> multiplication and division operations. At that point, what you get
> back from the operation is an approximation and not the actual
> number.

Bull! Nearly all computer floating point numbers are approximations
because of being held in binary rather than decimal. Any number with a
(decimal) fractional part that doesn't end with the digit 5 is
necessarily an approximation, and that's only half the story. So as soon
as you involve numbers like 0.1 or 0.2, you've already got minor
inaccuracies which will propagate through any kind of arithmetic -- it's
just worse with multiplication or division because these tend to result
in inaccuracy in more significant digits!

Bottom line: a floating point value should *always* be treated with an
appropriate degree of suspicion.

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

-- 
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