Re: About N in Mathematica 4

• To: mathgroup at smc.vnet.net
• Subject: [mg25358] Re: About N in Mathematica 4
• From: "Allan Hayes" <hay at haystack.demon.co.uk>
• Date: Sun, 24 Sep 2000 03:01:28 -0400 (EDT)
• References: <8qhn06\$j09@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```N[Pi, 3]

3.14159

In fact we get 16 digits for machine numbere (inexact with less than 18
significant digits, test with MachineNumberQ) but only 6 are displayed
(controled by option PrintPrecision - see option inspector).

% // InputForm

3.141592653589793

To show three decimal places we control the display with NumberForm:

NumberForm[N[Pi], {Infinity, 3}]

"3.142"

Arbitrary precision numbers (eg inexact with >17 significant digits) with
precision pr display pr, possibly pr+1, significant digits)

NumberForm[N[Pi, 30], DigitBlock -> 5]

"3.14159,26535,89793,23846,26433,8328"

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Sistrall" <silvano.stralla at tin.it> wrote in message
news:8qhn06\$j09 at smc.vnet.net...
> Hi!
>
> I've a question about the function N in Mathematica 4. I haven't found
>
> The question is: why if I use N[Pi,30] I'll have a number of 30 decimal
> digits, but with N[Pi,10] or N[Pi,3] I'll get a number of 6 digits?
>
> The right number of digits is given only if I use a precision bigger than
> the precision of the machine. But if I want a number of 3 decimal digits?
>
> Thanks.
>
>
>

```

• Prev by Date: Re: Stochastic differential equations
• Next by Date: Re: Differential operators, Help