[Date Index] [Thread Index] [Author Index]
Re: unser-interface problems using Mathematica as a calculator
> The example below illustrates why Mathematica's > display rules for approximate numbers are very > confusing for students. Should this be considered a > user-interface bug? If not, why not? In any case, can > the default display be changed to something more > familiar from spreadsheets and other computing > languages? > Thanks, > Alan Isaac > > In:= tv = TimeValue[1, 0.04, 3] > tv == 1.124864 > tv == 1.12486 > > Out= 1.12486 > > Out= True > > Out= False > A statement like this "x == 1.123" is usually a bug (except in a very very VERY specific circumstances), and students should not use it. The the value of x is usually a result of an expression, and different, but mathematically identical implementations of the expression will usually give slightly different numerical results. The test should be: "Abs[x - 1.123] < EPS", where EPS is a small number that depends on the estimation of numerical truncation errors (which depends on the expression).