Re: This calculation is just wrong / computer can't count!




"GT" <ContactGT_remove_@xxxxxxxxxxx> wrote in message
news:0057a9e0$0$2887$c3e8da3@xxxxxxxxxxxxxxxxxxxx
Why is everyone having a go at me?

I apologise if you felt that I was having a go at you.
As I said, many people (myself included in the past) have struggled to
understand the cause of this problem which is due to the way floating point
numbers are stored in their internal binary representation.

This is the concept I and others have been trying to get across.

If I may show you an example from Another Language (but the principle is the
same)
(From Dave Eklund, Compaq Fortran Engineering)

"Consider 5.0 divided by powers of 10.:
do i = 1,10
x = 5.0/(10.**i)
type 1, x, x
1 format (1x, f40.30, 1x, b)
enddo
which produces in decimal and binary :

0.500000000000000000000000000000 111111000000000000000000000000
0.050000000745058059692382812500 111101010011001100110011001101
0.004999999888241291046142578125 111011101000111101011100001010
0.000500000023748725652694702148 111010000000110001001001101111
0.000049999998736893758177757263 111000010100011011011100010111
0.000004999999873689375817775726 110110101001111100010110101100
0.000000499999998737621353939176 110101000001100011011110111101
0.000000050000000584304871154018 110011010101101011111110010101
0.000000004999999969612645145389 110001101010111100110001110111
0.000000000499999985859034268287 110000000010010111000001011111
Only that first one is EXACT! Notice that the others,
while "close" to .05, .005, .0005. etc. are not EXACTLY .05, .005, .0005
etc. Some are a little bigger, some smaller (popularly called "nines
disease"). In fact, with the exception of 0.500, all the others CANNOT be
exactly represented as sums of powers of 2!"

"SUMS OF POWERS OF 2" That is the key to understanding computer floating
point math.

Les


.



Relevant Pages

  • Re: a question related to Warings problem
    ... Waring's problem and asked how many fourth powers are needed ... The sums of 14 fourth powers or less must be at least as sparse ... only requiring positive density that suggests to me ... The counting function for sums of 1 kth power is x^, ...
    (sci.math)
  • a question related to Warings problem
    ... sum of 9 cubes. ... Waring's problem and asked how many fourth powers are needed ... The sums of 14 fourth powers or less must be at least as sparse ... only requiring positive density that suggests to me ...
    (sci.math)
  • Re: Equal Sums of Like Powers for k = 1,3,5,7 (Feasible class project)
    ... If you need a computational project for a class, ... the problem "Sum of four 7th powers equals sum of five 7th powers", ... sums match as well. ...
    (sci.math)
  • Re: a question related to Warings problem
    ... sum of 9 cubes. ... Waring's problem and asked how many fourth powers are needed ... The sums of 14 fourth powers or less must be at least as sparse ... only requiring positive density that suggests to me ...
    (sci.math)
  • Re: Tetration and integrals
    ... This gives the first few terms of the powerseries ... From this one may compute derivatives or integrals ... The integrals of the powers of logare ... This gives a scheme for divergent sums ...
    (sci.math)

Loading