Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Setting precision in binary digits?

11 views
Skip to first unread message

Fergal Shevlin

unread,
Oct 4, 1997, 3:00:00 AM10/4/97
to

Hello,

I would like to specify the precision of my numbers in binary digits
rather than decimal digits. Is there any way of doing this?

Many thanks,
Fergal.

--
====================================================================
Fergal Shevlin Phone: +353-1-6081209 Fax: 6772204
Dept. of Computer Science http://www.cs.tcd.ie/
Trinity College, Dublin 2, Ireland. Fergal....@cs.tcd.ie


Robert Knapp

unread,
Oct 7, 1997, 3:00:00 AM10/7/97
to

Fergal Shevlin wrote:
>
> Hello,
>
> I would like to specify the precision of my numbers in binary digits
> rather than decimal digits. Is there any way of doing this?
>

The precision of numbers is kept in Mathematica as a real quantity.
This
means that you can easily specify a precision in binary digits by
multiplying
by Log[10.,2.]. For example

In[1]:= InputForm[SetPrecision[1/7,20*Log[10.,2.]]]
Out[1]//InputForm= 0.142857142857142849`6.0206

In[2]:= 6.0206*Log[2.,10.]
Out[2]= 20.

The InputForm gives you the fractional (with repect to base 10)
precision,
If you use the command Precision, this is rounded to the nearest
integer,
so the conversion won't appear quite correctly. In the next version of
Mathematica there will be options that allow you to prevent this
rounding.

Rob Knapp
Wolfram Research


0 new messages