Re: Error in Subtraction with V4.0??
- To: mathgroup at smc.vnet.net
- Subject: [mg22545] Re: [mg22463] Error in Subtraction with V4.0??
- From: Bojan Bistrovic <bojanb at python.physics.odu.edu>
- Date: Thu, 9 Mar 2000 03:24:29 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
> Can someone please explain why > > 1. - .999999999999 > > results in > 9.999778782798785*10^-13 > > The old way (by hand) gives me > > 1x10^-12 > > Is this an error or am I missing something? > > TIA, > > John Brooks > Mathematica stores real numbers (as any other computer program) in binary form; converting from binary to decimal and the other way around means losing precision. When you do it by hand, what you're actually doing is: 1 - 999999999999/1000000000000 which will give you 1/1000000000000 or after using N[%] 1. * 10^-12 In other words, when you do 1.-0.99999999999 "by hand" you implicitly convert it to exact numbers 1 and 99999999999/100000000000 and THEN do the math; Mathematica can do it as well, you just have to phrase the question properly. Bye, Bojan -- --------------------------------------------------------------------- Bojan Bistrovic, bojanb at jlab.org Old Dominion University, Norfolk VA & Jefferson Lab, Newport News, VA ---------------------------------------------------------------------