MathGroup Archive 2004

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

Search the Archive

Re: Formatting numbers for output


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.
> 



  • Prev by Date: Re: conditionnal rule
  • Next by Date: Re: MultipleListPlot without any Point Shape, only with line made by PlotJoined -> True tests=INVALID_DATE,QUOTED_EMAIL_TEXT,RCVD_IN_ORBS,
  • Previous by thread: Formatting numbers for output
  • Next by thread: Re: Formatting numbers for output