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

MathGroup Archive 2007

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

Search the Archive

Re: NumberForm question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82036] Re: NumberForm question
  • From: Yaroslav Bulatov <yaroslavvb at gmail.com>
  • Date: Wed, 10 Oct 2007 04:24:29 -0400 (EDT)
  • References: <fefip7$jpm$1@smc.vnet.net>

The problem is not the font size, but rather that it's rounded to the
nearest 10^-15, even though there's enough digits to round to round at
much finer scale.
You can see this rounding behavior here

l1 = ToExpression[
      ToString[NumberForm[1 + # $MachineEpsilon, {20, 20}]]] & /@
    Range[20] - 1;
l2 = ToExpression[ToString[InputForm[1 + # $MachineEpsilon]]] & /@
    Range[20] - 1;
ListPlot[{l1, l2}, Joined -> {False, True}]


On Oct 9, 2:48 am, Bill Rowe <readnews... at sbcglobal.net> wrote:
> On 10/8/07 at 2:03 AM, yarosla... at gmail.com (Yaroslav Bulatov) wrote:
>
> >x=1+$MachineEpsilon; InputForm[x] NumberForm[x,{16,16}]
> >Why does the result printed by NumberForm seem smaller?
>
> They use different fonts. I would expect InputForm to use
> whatever font format you have set in your preferences for input
> while NumberForm will use what ever font defaults you set up for output.
>
> In my case, I have input set to StandardForm while output set to
> TraditionalForm and see two different fonts when I copy your
> code into a new cell. But if I do:
>
> x=1+$MachineEpsilon;
> InputForm[x]
> NumberForm[x,{16,16}]//StandardForm
>
> both lines appear to be the same size on my system.
> --
> To reply via email subtract one hundred and four




  • Prev by Date: Re: FunctionExpand problem in version 6
  • Next by Date: Re: NumberForm question
  • Previous by thread: Re: NumberForm question
  • Next by thread: Re: NumberForm question