MathGroup Archive 1998

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

Search the Archive

RE: defining precision (Q:)




m.r.  wrote:
 ----------
|
|i would like Mathematica3.0 to act as though it is producing
|single-precision
|
|results.
|
|is this done using N?
|
|sincerely,
|
|m. r.
|
Machine arithmetic is done with double precision by default. That's what
you get using N[expr].

I am not certain, but I think single precision has a 26 bit mantissa.
That gives a relative error of (2.0^-26)=(1.49*10^-8).  If I am wrong
about  the size of a single precision mantissa just change the exponent
below.

If you want to compute Sqrt[2] with single precision do the following:

In[2]:=
SinglePrecision=Log[10, 2.0^26];
SetPrecision[Sqrt[2], SiglePrecision]

Out[2]=
1.4142136

If you want all calculations done with single precision you can change
the  value of
$MaxPrecision.

In[3]:=
$MaxPrecision=SinglePrecision;

In[4]:=
a=Sqrt[2.0]

Out[4]=
1.41421

In[5]:=
Precision[a]
Precision::"mxprec":
    "Value \!\(16\) would be inconsistent with $MaxPrecision; bounding
by \ $MaxPrecision instead."

Out[5]=
8.12781


Ted Ersek




  • Prev by Date: RE: [Q] how to use simple nota
  • Next by Date: RE: Bivariate InverseErf funct
  • Prev by thread: defining precision (Q:)
  • Next by thread: Re: defining precision (Q:)