[Date Index]
[Thread Index]
[Author Index]
Re: Beware of adding 0.0
*To*: mathgroup at smc.vnet.net
*Subject*: [mg50237] Re: Beware of adding 0.0
*From*: Richard Fateman <rfateman at sbcglobal.net>
*Date*: Sun, 22 Aug 2004 00:19:48 -0400 (EDT)
*References*: <cg4fcn$cf5$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
Paul, since you are copying this from my posting to sci.math.symbolic
of August 19,2004, (yesterday) perhaps you should give me credit.
I took the example from my own paper, A Review of Mathematica,
which appeared in J. Symbolic Computation,(1992) and a version of which
is online. You might also read Mark Soufroniou's INRIA paper (1999?)
explaining why this behavior is apparently intentional, even if it is
hard to explain (shown by the responses you got).
The idea that 0.0 should represent all numbers in [-1,1]* 2^{-precision}
is generally regarded with skepticism by computational scientists. Some
of the other consequences of this are discussed by Soufroniou and others.
RJF
paul wrote:
> In Mathematica 5.0, I get a very strange result when I add 0.0 to a number,
> why is this? See below:
>
> p = SetPrecision[314159265358979323, 25]
> q = SetPrecision[314159265358979323., 25]
> r = SetPrecision[314159265358979323.00000000000000000000, 25]
> s = SetPrecision[p + 0.0, 25]
> {p == q, q == r, r == s, r == p}
> {Tan[s], N[Tan[p]], Tan[q], Tan[r]}
>
>
> \!\(3.14159265358979323`25.*^17\)
> Out[47]=
> \!\(3.14159265358979323`25.*^17\)
> Out[48]=
> \!\(3.14159265358979323`25.*^17\)
> Out[49]=
> \!\(3.14159265358979328`25.*^17\) *****NOTICE the 28 instead of 23 at the
> end, why does this happen? *******
> Out[50]=
> {True, True, False, True}
> Out[51]=
> {1.599808, -1.12979, -1.1297927, -1.1297927}
>
Prev by Date:
**Re: Beware of adding 0.0**
Next by Date:
**Re: Re:Playing with numbers**
Previous by thread:
**Re: Beware of adding 0.0**
Next by thread:
**Re: Re: Beware of adding 0.0**
| |