Re: SetPrecision - What does in find?
- To: mathgroup at smc.vnet.net
- Subject: [mg48300] Re: SetPrecision - What does in find?
- From: "Peltio" <peltio at twilight.zone>
- Date: Sat, 22 May 2004 03:04:31 -0400 (EDT)
- References: <c8kcs0$mpv$1@smc.vnet.net>
- Reply-to: "Peltio" <peltioNOSP at Mdespammed.com.invalid>
- Sender: owner-wri-mathgroup at wolfram.com
"Kazimir" wrote >SetPrecision[.14, Infinity] > 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. 0.14 is a machine precision number whose 'exact' expression is not representable with a finite number of binary digits of mantissa. In most 32 bits machines a machine precision number has 53 bits of mantissa (this gives roughly 16 decimal digits). In base 2, 0.14 looks like this: 0.0010001111010111000010100011110101110000101000111101100... And the trailing dots mean that the expansion goes on after that point. If you truncate the binary expansion of the mantissa to the 53rd digit (actually it could be one digit less, because of the normalization) you get the machine representable number closest to 0.14. It has at least 16 digits in common with 0.14. If you compute with infinite precision the sum of the (negative) powers of 2 corresponding to that expansion, you should get 1261007895663739/9007199254740992 Try this: {mantissa, exp} = RealDigits[0.14, 2] fract= PadLeft[mantissa, Length[mantissa] - exp] MapIndexed[#1*(1/2^#2) & , fract] Plus @@ % Does it work? cheers, Peltio Invalid address in reply-to. Crafty demunging required to mail me.