MathGroup Archive 1995

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

Search the Archive


  • To: mathgroup at
  • Subject: [mg445] precision
  • From: "Ed Boss" <boss at>
  • Date: Fri, 3 Feb 95 11:44:43 -1000

Jonathan Rich writes:

Is there any way to specify, at the start of a session, or at the start of
a Mathematica script or program, that one would like MMA to use a given
precision (i.e. something other than $MachinePrecision) thruout the
calculations?  It doesn't appear to me that "PrecisionGoal" is what I want
as that is an option for specific numerical functions.  In other words,
what I want is something like "SetPrecision[]", but not for a specific
expression but rather a global default value which tells MMA to assume such a
precision for all expressions and numerical calculations, unless specified
otherwise.  Then when
one typed "x=3.", x would automatically have whatever precision one had
globally set at the beginning of the session.  I guess this would
correspond to use of C or Fortran compiler flags like "-r8" that
instruct the compiler that all variables are to be double precision
(for example).  Is there a way of doing such a thing in mathematica?

Thanks for your help and advice.

Jonathan Rich

I believe waht you want to do is set the global variable $Post.  From Nancy
Blachman's book, Mathematica: A Practical Approach,  page 28:

In: nThirty[x_] := N[x,30]
In: nThirty[5/7]
Out: 0.71428571428571428571428571429
In: $Post = nThirty
Out: nThirty
In: Sqrt[3]
Out: 1.73205080756887729352744634151
In: Precision[%]
Out: 30.

To return to the default precesion

In: $Post =.


Ed Boss                                               .^ *
NOAA/Pacific Marine Environmental Laboratory         /  /
                                                    /   |
                                                   /     \
                                           ___.---~       `*------ ...

  • Prev by Date: verify equation identity
  • Next by Date: Question
  • Previous by thread: verify equation identity
  • Next by thread: Question