Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Displaying Real Numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85358] Re: [mg85338] Displaying Real Numbers
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Thu, 7 Feb 2008 04:46:31 -0500 (EST)
  • Reply-to: hanlonr at cox.net

myNumberForm[x_, decimalPlaces_: 2] := 
  If[decimalPlaces < 1, Round[x], ToString[IntegerPart[x]] <> "." <> 
    ToString[Round[FractionalPart[x]*10^decimalPlaces]]];

x = 173845955435493737/50000;

myNumberForm[x, 5]

3476919108709.87474


Bob Hanlon

---- Lea Rebanks <lrebanks at netvigator.com> wrote: 
> 
> Hi All,
> 
> Here's a really simple question
> 
> I have the output.
> 
> 173845955435493737/50000 
> 
> I am trying to display this number as a real number showing decimals.
> But I don't want to see the output as a fraction or scientific 
> notation.
> 
> N[173845955435493737/50000,20]
> 3.4769191087098747400=D71012
> 
> The number should look something like  =933476919108709.87474=94
> 
> 
> IntegerPart[173845955435493737/50000]
> 3476919108709
> FractionalPart[173845955435493737/50000]//N
> 0.87474
> 
> Any help or advice gratefully received.
> 
> Best Regards - Lea Rebanks...
> 
> 



  • Prev by Date: Mathematica, MacOS-X, Command-line
  • Next by Date: NIntegrate - bug??
  • Previous by thread: Re: Displaying Real Numbers
  • Next by thread: Re: Displaying Real Numbers