[Date Index] [Thread Index] [Author Index]
RE: Errors with decimal addition in Mathematica 5.0
A very frequent question. Mathematica, by default, displays approximate numbers to 6 places of precision. (Internally, they are stored to the machine precision. Any number with a decimal point is an approximate number.) The purpose of N is to convert EXACT numbers (like Pi or Sqrt) to approximate numbers so it doesn't help. Use NumberForm to display to higher precision. 13505.5 - 244.91 NumberForm[%, 8] 13260.6 13260.59 You could also change the default display precision in the Options Inspector: FormattingOptions/Expression Formatting/Display Options/Print Precision. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Peng Yu [mailto:yupeng_ at hotmail.com] To: mathgroup at smc.vnet.net In:= 13505.5 - 244.91 Out= 13260.6 However,13505.5 - 244.91 = 13260.59. "N" doesn't help, either. In:= N[13505.50 - 244.91] Out= 13260.6 But the following command gives the correct answer. In:= 505.50 - 244.91 Out= 260.59 How can I get the correct last digit? Thanks!