Re: Formatting numbers for output
- To: mathgroup at smc.vnet.net
- Subject: [mg51538] Re: Formatting numbers for output
- From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
- Date: Thu, 21 Oct 2004 22:21:05 -0400 (EDT)
- References: <cl4tlm$8hs$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Here is an example of what you could do:
Map[NumberForm[#,{4,2},NumberPadding->{"","0"}]&,Table[Random[],{10}]]
This generates a list of 10 random numbers in the range [0,1], and the {4,2}
in NumberForm displays them as 4 digit reals with 2 digits to the right of
the decimal point. The key trick is to use the option
NumberPadding->{"","0"}.
Steve Luttrell
"Alex Gittens" <rubberduckie at gmail.com> wrote in message
news:cl4tlm$8hs$1 at smc.vnet.net...
> I'm trying to construct a GridBox with entries that have 2 digits
> after the decimal. So far, the only way I've seen to get rid of the
> NumberMarks is to use
> SetPrecision[x, :inf:], but that makes all the numbers into fractions.
> Is there a better alternative?
>
> Thanks,
> Alex
>
> --
> The heart of mathematics consists of concrete examples and concrete
> problems.
>