Number Formatting
- To: mathgroup at smc.vnet.net
- Subject: [mg17714] Number Formatting
- From: "David Park" <djmp at earthlink.net>
- Date: Sun, 23 May 1999 02:25:29 -0400
- Sender: owner-wri-mathgroup at wolfram.com
MathGroup,
Sometimes I like to use N to set the display precision of a number.
However it seems to have strange behavior.
TableForm[Table[N[248713.11673961558`, i], {i, 1, 9}]]
300000.
250000.
249000.
2.487 x 10^5
2.4871 x 10^5
248713.
248713.1
248713.12
248713.117
Why is the first entry rounded the wrong way? Why the switch into and
out of exponent format? Except for the first three entries one might
say it only shows the number of digits in the precision. But then why
not use exponent notation for the first three entries also?
When NumberForm is used instead of N, the rounding is correct, there
are no exponent forms used, and there are NumberForm::sigz warning
messages when there are trailing nonsignificant zeros.
Is the lesson that N is not really meant for number formatting, and
N[expr, 1] should never be used? In some fields, one place precision
is quite respectable!
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
- Follow-Ups:
- Re: Number Formatting
- From: Jean-Marie Thomas <jmthomas@agat.net>
- Re: Number Formatting