       Re: On default numerical precision

• To: mathgroup at smc.vnet.net
• Subject: [mg90740] Re: On default numerical precision
• From: sergio_r at mail.com
• Date: Tue, 22 Jul 2008 03:57:34 -0400 (EDT)
• References: <g5pj07\$qbc\$1@smc.vnet.net> <g5s9q0\$51h\$1@smc.vnet.net>

>From a mathematica help page:
http://reference.wolfram.com/mathematica/ref/\$Pre.html
http://reference.wolfram.com/mathematica/ref/\$Post.html

\$Pre
is a global variable whose value, if set, is applied to every input
expression.
\$Post
is a global variable whose value, if set, is applied to every output
expression.

Does this mean that one needs to set both variables to maintain
precision throughout a computational sesion?

\$Pre = ( #1 /. a_Real :> SetPrecision[a, 32]) &;
\$Post = ( #1 /. a_Real :> SetPrecision[a, 32]) &;

Regards,

Sergio
PS. I am trying this stuff on a computer having
In:= \$Version
Out= 5.0 for Linux (June 9, 2003)

On Jul 20, 6:58 am, sergi... at mail.com wrote:
> Jens thanks for you reply. I am not sure what
> I am missing but here are the results of following
> the sugested approach:
>
> In:= \$Post = ( # /. a_Real :> NumberForm[a, {32, 16}]) &;
>
> In:= a=2.
>
> Out//NumberForm= 2.
>
> In:= b=3.
>
> Out//NumberForm= 3.
>
> In:= a*b
>
> Out//NumberForm= 6.
>
> But the following form works the way I was looking
> for:
>
> In:= \$Post =.
>
> In:= \$Post
>
> Out= \$Post
>
> In:= \$Post = ( # /. a_Real :> SetPrecision[a, 32]) &;
>
> In:= a=2.
>
> Out= 2.0000000000000000000000000000000
>
> In:=  b=3.
>
> Out= 3.0000000000000000000000000000000
>
> In:= a*b
>
> Out= 6.0000000000000000000000000000000
>
> Thanks again,
>
> Sergio
>
> On Jul 19, 4:49 am, Jens-Peer Kuska <ku... at informatik.uni-leipzig.de>
> wrote:
>
> > Hi,
>
> > \$Post = ( # /. a_Real :> NumberForm[a, {32, 16}]) &;
>
> > Regards
> >    Jens
>
> > sergi... at mail.com wrote:
> > > Hello all,
>
> > > I am wonderin on how to change the mathematica default printing
> > > precision, so I don't have to type on any defined constant the
> > > required  precision, like " `30 "  in:
>
> > > In:= a=2.3`30; b=2.1`30;
>
> > > In:= a*b
>
> > > Out= 4.83000000000000000000000000000
>
> > > I would like  to be able to do:
>
> > > a=2.3; b=2.1; and obtain
> > > a*b = 4.83000000000000000000000000000
>
> > > Regards,
>
> > > Sergio
> > > PS. Apparently the internal variable \$Pre could be set to do that, but
> > > the respective help page [  http://reference.wolfram.com/mathematica/ref/\$Pre.html
> > >    ] is not clear about how to do that.

• Prev by Date: Re: export eps
• Next by Date: NDSolve[] with nested If[] and Piecewise[] usage:
• Previous by thread: Re: On default numerical precision
• Next by thread: Corrupt graphics output