[Gllug] Basic numerical precision question

Sanatan Rai sanatan at gmail.com
Sat Sep 25 23:51:54 UTC 2010


On 26 September 2010 00:40, lesleyb <lesleyb at herlug.org.uk> wrote:
> On the basis that machine epsilon is the smallest positive number
> distinguishable from 0, and that the absolute value of your result
> is larger than epsilon, your problem is where exactly?

   Sure it can be larger, but I don't expect it to be 1000 times larger.
I expect the difference to be of the order of the epsilon, ie of
the order of 1e-16.

> But I am still suspicious -
>  (a + b) * (a + b) = a^2 + b^2 +2ab > a^2+b^2 when a,b > 0.
>
> sum2 is equivalent to a^2 + b^2
> sum  is equivalent to (a+b)*(a+b)
>
> Thus sum > sum2 always.
>

    Not quite, you are missing the averaging.
The average of squares >= the square of the average always.


--Sanatan
-- 
Sanatan Rai
3, Admirals Court,
30, Horselydown Lane,
London, SE1 2LJ.
+44-20-7403-2479.
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list