On Thu, Feb 2, 2012 at 1:16 PM, Julien Puydt <julien.pu...@laposte.net>wrote:

>
> Well, if I don't err, $10^{17}$ has 18 decimal digits, which is more than
> the 15,95.. that fit in 53 binary digits.
>

It is not that simple. 15.95 digits is more like a guideline. At issue is
whether the number in question can be exactly represented in double
precision, and in this case it can be. You can check this (ignoring
possible issues with the size of the exponent, which don't occur here) with:

sage: ZZ(RealField(53)(1.7e17)) == 17*10^16

In fact, 42 bits suffices, but not 41:

sage: ZZ(RealField(42)(1.7e17)) == 17*10^16
True
sage: ZZ(RealField(41)(1.7e17)) == 17*10^16
False

Instead, you could just look at it in base two

sage: (17 * 10^16).str(base=2)
'1001011011111101100001100101101011110100010000000000000000'

and count the length of the string not including the trailing zeros:

sage: len((17 * 10^16).str(base=2).strip('0'))
42

So, in this case, I would say that there is either a bug in maxima or a bug
in the sage code that converts from maxima. I've been trying to guess what
that bug would be, but I don't have a guess right now.

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to