       bugs with N ...

• To: mathgroup at yoda.ncsa.uiuc.edu
• Subject: bugs with N ...
• From: fateman at ucbarpa.Berkeley.EDU (Richard Fateman)
• Date: Sat, 6 Oct 90 11:04:15 -0700

```Telling fortunes by reading N-trails?

Mathematica (sun3.68881) 1.2 (November 6, 1989) [With pre-loaded data]

(* Change \$Post to look at all three attributes on display *)

In:= p[x_]:= {x, Accuracy[x], Precision[x]}

In:= \$Post=p

.....
In:= N[Sin[10^16],16,16]

Out= {0.779679945161067, 16, 16}

In:= N[Sin[10^16],20]
(* increasing precision decreases "Accuracy" *)
Out= {0.78, 4, 4}

In:= N[Sin[10^16],50]

Out= {0.7796880066069787502355279540333621, 34, 34}

In:= a=10^50

In:= N[Sin[a],16]

Out= {0.0937537918202386, 17, 16}
(* this answer is not good to 17 places. it is wrong in all places,
and even has the wrong sign. *)

In:= N[Sin[a],20]

Format::imz: Warning: Number with negative accuracy being printed as 0.
Out= {0., -30, 0}
(* I think this means that Mathematica cannot determine Sin[a] within
a range of -10^30 to +10^30.  Most people think that for real arguments
the sine function is restricted to [-1,1] *)
In:= N[Sin[a],49]

Out= {0., -1, 0}

..

In:= N[Sin[a],52]

Out= {-0.8, 2, 2}

In:= N[Sin[a],60]

Out= {-0.789672493, 10, 10}

In:= b=N[a,60]

Out= {100000000000000000000000000000000000000000000000000., 10, 60}

(* M'ma's policy of making this number "accurate" to 10 places leads
to foolishness. Why the location of the decimal place is so important,
is hard to understand.  Are meters more accurate than millimeters? *)
In:= Sin[b]

Out= {-0.789672493, 10, 10}

In:= N[Sin[b],16]

Out= {-0.7896724934295026, 16, 16}

In:= N[Sin[b],18]

Out= {-0.789672493, 10, 10}

...
In:= N[Sin[b],100]

Out= {-0.789672493, 10, 10}

....
Of course some of these  anomalies are easily explained by knowing
how Mathematica "works".  That does not make them necessarily more
comforting.
-- Richard Fateman

```

• Prev by Date: Question
• Next by Date: Answer to "Points problem"