Re: On default numerical precision
- To: mathgroup at smc.vnet.net
- Subject: [mg90705] Re: On default numerical precision
- From: sergio_r at mail.com
- Date: Sun, 20 Jul 2008 06:33:22 -0400 (EDT)
- References: <g5pj07$qbc$1@smc.vnet.net> <g5s9q0$51h$1@smc.vnet.net>
Jens thanks for you reply. I am not sure what
I am missing but here are the results of following
the sugested approach:
In[1]:= $Post = ( # /. a_Real :> NumberForm[a, {32, 16}]) &;
In[2]:= a=2.
Out[2]//NumberForm= 2.
In[3]:= b=3.
Out[3]//NumberForm= 3.
In[4]:= a*b
Out[4]//NumberForm= 6.
But the following form works the way I was looking
for:
In[5]:= $Post =.
In[6]:= $Post
Out[6]= $Post
In[7]:= $Post = ( # /. a_Real :> SetPrecision[a, 32]) &;
In[8]:= a=2.
Out[8]= 2.0000000000000000000000000000000
In[9]:= b=3.
Out[9]= 3.0000000000000000000000000000000
In[10]:= a*b
Out[10]= 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[1]:= a=2.3`30; b=2.1`30;
>
> > In[2]:= a*b
>
> > Out[2]= 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.