MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Precision of output


On 17 May 2004, at 16:22, Per Rønne wrote:

> If I write:
>
> N[4209/0.14,100] I get:
> 30064.3
>
> But if I write N[420900/14,100] I get:
> 30064.28571428571428571428571428571428571428571428571428571428571428571 
> 4
> 285714\
> 28571428571428571428571
>
> Why the difference? I thought N determined the number of digitals shown
> - but I seem to have some problems with this function. And it is not in
> this example only.
>
> TeachersEdition 1.1 with Mathematica 4.2 kernel.
> -- 
> Per Erik Rønne
>
The number 0.14 is a MachinePrecision number and hence automatically so  
is 4209/0.14 and so is any expression contianing at least one  
MachiePrecision quantity.  N has no effect on MachinePrecision numbers.  
You can see more digits if you just evaluate:


4209/0.14//InputForm

30064.285714285714

but these are all the digits you get with MachinePrecision numbers.

If you want to use use exact numbers in input and then specify to how  
many digits you want the computation to be made (as you did in your  
other example). You can also use N with "extended precision numbers" it  
it makes know sense to ask it to return more precision than you have in  
your input.


Andrzej Kozlowski
Chiba, Japan
http://www.mimuw.edu.pl/~akoz/


  • Prev by Date: Re: Mean
  • Next by Date: Re: colored alphabet for string output
  • Previous by thread: Precision of output
  • Next by thread: Re: Precision of output