MathGroup Archive 2004

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

Search the Archive

Re: SetPrecision - What does in find?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48299] Re: [mg48282] SetPrecision - What does in find?
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Sat, 22 May 2004 03:04:30 -0400 (EDT)
  • References: <200405210754.DAA23247@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Kazimir wrote:
> Let us run
> 
> SetPrecision[.14, \[Infinity]]
> 
> MATHEMATICA returns 1261007895663739/9007199254740992. What is the
> mathematical (in the sens of mathemaics as a science) reason to give
> this answer? I would say that 7/50 is much a better answer.
> 
> It looks like that the MATHEMATICA's (in the sens of rules of
> MATHEMATICA)  reason 1261007895663739/9007199254740992 can be observed
> by the command
> 
> N[1261007895663739/9007199254740992, 100]
> 
> which answers .14000000000000001332267629550187848508358001708984375000000
> 00000000000000000000000000000000000000000
> 
> It puts 14 zeros after .14 to coinside with 14/100 within the machine
> precision which is about 16, than it puts an arbitrary number and than
> it puts zeros again. It looks that the number is the exact
> presentation of the fractoin 1261007895663739/9007199254740992, but it
> is not exactly .14, the deviation being the machine precission.
> 
> MATHEMATICA tries to find a fraction which has a finit digital 
> presentation, but which defers from the .14 by a michine precision. Is
> there a meaning to obtaing a number like this?
> 

SetPrecision works with the binary representation of the number. Thus 
SetPrecision[n,Infinity] will return a dyadic rational (that is, power 
of 2 denominator). In the example above it is 2^53.

What you observe with N[SetPrecision[.14,Infinity],100] is the effect of 
the binary zero pading of SetPrecision.

To obtain a rational with a "small" denominator when one exists, one can 
use Rationalize.

In[8]:= Rationalize[.14] // InputForm
Out[8]//InputForm= 7/50


Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: padding numbers in front of uniquely generatd names
  • Next by Date: RE: SetPrecision - What does in find?
  • Previous by thread: SetPrecision - What does in find?
  • Next by thread: Re: SetPrecision - What does in find?