why the inconsistency?
Michael Hudson
mwh at python.net
Fri Sep 26 14:04:24 EDT 2003
"Tim Peters" <tim.one at comcast.net> writes:
> [Christos "TZOTZIOY" Georgiou'
> >>> If only math.log(2**64)/math.log(10) worked with longs without
> >>> converting them into floats first... :(
> >>
> >> And after reading the FM, if only
> >>
> >> def count_digits(x):
> >> return int(math.log(x, 10))
> >>
> >> worked correctly for *all* large values, like 10**70...
>
> [Michael Hudson]
> > Um, it does :-)
> >
> > >>> float(40**200)
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in ?
> > OverflowError: long int too large to convert to float
> > >>> math.log(40**200, 14)
> > 279.56038792470861
> >
> > (10**70 is well within the range of an IEEE double).
>
> You're not used to answering floating-point questions <wink>.
Or prehaps just conveniently ignoring what "work" means in a given
context :-)
Cheers,
mwh
--
Make this IDLE version 0.8. (We have to skip 0.7 because that
was a CNRI release in a corner of the basement of a government
building on a planet circling Aldebaran.)
-- Guido Van Rossum, in a checkin comment
More information about the Python-list
mailing list