Pardon my ignorance, data conversion

Aahz Maruch aahz at netcom.com
Mon Jan 17 15:01:35 EST 2000


In article <oqpuv04ixm.fsf at titan.progiciels-bpi.ca>,
François Pinard  <pinard at iro.umontreal.ca> wrote:
>aahz at netcom.com (Aahz Maruch) writes:
>> Robert W. McGwier <rwmcgwier at home.com> wrote:
>>>
>>>I need to do the simple task of taking a nonnegative floating point
>>>variable and taking its integer part and storing it in an integer.
>>>Damned if I can find how to do it.
>>
>> import math
>> i = int(math.floor(real))
>
>Would not a mere:
>   integer_value = int(real_value)
>be sufficient?

Quite possibly; not being an expert on the intricacies of floating-point
conversions, I elected to provide a straight translation -- besides, if
Robert is asking about floor(), zie probably wants other math functions,
too.
--
                      --- Aahz (@netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Have a *HAPPY* day!!!!!!!!!!



More information about the Python-list mailing list