MathGroup Archive 2000

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

Search the Archive

Re: Can I force arbitary precision

  • To: mathgroup at
  • Subject: [mg25579] Re: Can I force arbitary precision
  • From: "Allan Hayes" <hay at>
  • Date: Mon, 9 Oct 2000 01:16:43 -0400 (EDT)
  • References: <8rou5r$>
  • Sender: owner-wri-mathgroup at

"wkuang" <wkuang at> wrote in message news:8rou5r$5e6 at
> Hi,
> I am doing a little numerical calculation on Mathematica. The problem is
> that if I input a number as 1.7341421*^-9, mathematica automatically
> trim it to machine precision number. Yes, I can force the number as 200
> digit precision, but efficiency sacrificed. And I have to try different
> precision to make sure that it runs as fast and as accurate. My question
> is: can I force an arbitary precision so that I could throw the
> precision and accuracy problem to mathematica? thanks
> --
> Wan Kuang
> Electric Engineering - Electrophysics
> University of Southern California
> Los Angeles, CA 90007

An important feature for numerical work is that if expr is an exact numeric
expression (built up from integers, rationals, constants like Pi and E,
complex numbers with such real and imaginary parts, and functions having the
attribute NumericFunction), then,  if p>$MachinePrecision,
N[expr,p] will increase its working precision to try to return an output
with precision p (this increase in working precision can only be up to
$MachinePrecision + $MaxExtraPrecision (default value 50 but can be set by
the user)). The values obtained are cached; the cache can be cleared with





Make the input exact numeric.

SetPrecision[Hold[Sin[1.7341421*^40]], Infinity]


Now use N.

N[#, $MachinePrecision + 1] & @@ %




For more see Stan Wagon: Mathematica in Education and Research, Volume 7, No
2, Programming Tips, Bending Plot to Your Needs
Allan Hayes
Mathematica Training and Consulting
Leicester UK
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

  • Prev by Date: Re: Complex Function Plot
  • Next by Date: Re: making a function linear
  • Previous by thread: Can I force arbitary precision
  • Next by thread: 3-D HDF Importing and displaying