RE: defining precision (Q:)
- To: mathgroup@smc.vnet.net
- Subject: [mg11442] RE: [mg11401] defining precision (Q:)
- From: Ersek_Ted%PAX1A@mr.nawcad.navy.mil
- Date: Thu, 12 Mar 1998 01:33:35 -0500
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