[Zope] Python Function to Test for Integer Type
Terry Hancock
hancock at anansispaceworks.com
Thu Jun 17 12:19:45 EDT 2004
On Thursday 17 June 2004 05:31 am, Peter Bengtsson wrote:
> > The test will fail though if the floating point
> > value isn't *exactly* an integer.
> >
> >>>>int(1)==1.000001
> >
> > False
> >
>
> Interesting::
>
> >>> 1==1.00000000000000001
> True
> >>> 1==1.000000000000001
> False
> >>>
Yeah, means you exceeded the floating point precision of the
storage format. :-)
See:
>>> f = 1.000000000000001
>>> f
1.0000000000000011
>>> f = 1.00000000000000001
>>> f
1.0
That's what "exactly" means on a computer. :-D
Cheers,
Terry
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com
More information about the Zope
mailing list