MathGroup Archive 2001

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

Search the Archive

Re: simulating limited precision

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27820] Re: simulating limited precision
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Mon, 19 Mar 2001 01:29:11 -0500 (EST)
  • References: <98vic1$91p@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Murray,

SetAttributes[sp, HoldAll]
sp[x_]:=  Unevaluated[x]/.r_Real:>
      ToExpression[ToString[r]<>"`3"]
$Pre=sp;

1.00- 1.00*^3

\!\(\(-999.`2.9991\)\)

Which displays as  -1.0 10^3, so maybe it is not performing as you want.

$Pre=.

1.00- 1.00*^3

-999.


--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Murray Eisenberg" <murray at math.umass.edu> wrote in message
news:98vic1$91p at smc.vnet.net...
> I would like to explain creation of roundoff-error in addition by
> working with a precision of 3 decimal digits.  The following is an
> example:
>
>   1.00`3 - 1.00`3*^3
>
> which gives the "incorrect" result of -1.0 10^3.
>
> What I'd REALLY like to do is the same thing but without specifying
> explicitly the precision of each number -- by using the Standard AddOn
> package NumericalMath`ComputerArithmetic`.
>
> I tried the following:
>
>    <<NumericalMath`ComputerArithmetic`
>
>    SetArithmetic[3];
>
>    1.00 - 1.00*^3
> -999.
>
> Unfortunately, Mathematica here reverts to full machine precision.
>
> How do I use ComputerNumber to get the "wrong" answer -1.00 10^3 ?
>




  • Prev by Date: Re: Simple question about plot
  • Next by Date: Re: Simple question about plot
  • Previous by thread: Re: Mathematica to MIDI?
  • Next by thread: Re: NIntegrate problem