[IronPython] precision problem with Int64

curtin@acm.org brian.curtin at gmail.com
Mon May 19 15:36:41 CEST 2008


FWIW, using System.Convert.ToInt64(...) instead of System.Int64(...) works.

IronPython 1.1.1 (1.1.1) on .NET 2.0.50727.1433
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import System
>>> n = 8591464408876390743
>>> x = System.Convert.ToInt64(n)
>>> x
8591464408876390743L
>>> y = System.Convert.ToInt64(str(n))
>>> y
8591464408876390743L
>>> x == y
True

On Mon, May 19, 2008 at 3:47 AM, Ronnie Maor <ronnie.maor at gmail.com> wrote:

> Hi all,
>
> Is the following a known bug? (IPy 1.1.1)
>
> >>> import System
> >>> n = 8591464408876390743
> >>> x = System.Int64(n)
> >>> x
> 8591464408876390400L
> >>> y = System.Int64(str(n))
> >>> y
> 8591464408876390743L
> >>> x == y
> False
>
> n is positive and contained in 63 bits, so there shouldn't even be
> signed/unsigned issues.
>
> ?
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080519/ed92b10d/attachment.html>


More information about the Ironpython-users mailing list