Re: Does the order matter to add a sequence of floating numbers



JosephLee said:

Let's say float arr[100], we want to add them up, does the order
matter? what is the different between arr[0] +..+ arr[99], and
arr[99]+...+arr[0]?

You wouldn't think it would make a difference, would you? But it can,
nevertheless, especially when some or all of the values are near the
limits of what can be represented.

I tried fairly hard to write a program to demonstrate this, and failed. :-)

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages

  • Re: next term
    ... Richard Heathfield ... Google users: ... me@here> cat mapping.dot | dot -Tpng -o mapping.png ...
    (rec.puzzles)
  • Re: Searching in a random list
    ... them at the outset. ... Richard Heathfield ... Google users: ...
    (comp.programming)
  • Re: Whats the position of pointers
    ... will pop into your head, ... Richard Heathfield ... Google users: ...
    (comp.lang.c)
  • Re: new random numbers function
    ... So as long as you don't mind getting a two or a three 90% of the ... Richard Heathfield ... Google users: ...
    (rec.puzzles)
  • Re: An age-old riddle
    ... inscription into its right proportions. ... Richard Heathfield ... Google users: ...
    (rec.puzzles)