On Wed, Jul 13, 2016 at 11:16 PM, Jussi Piitulainen
<jussi.piitulai...@helsinki.fi> wrote:
>> Or just use divmod:
>>
>>>>> "%d.%02d" % divmod(1<<200, 100)
>> '16069380442589902755419620923411626025222029937827928353013.76'
>
> I'm not quite ready to blame floating point for this difference yet:
>
>>>> "%d.%02d" % divmod(-1,100)
> '-1.99'
>>>> "%.2f" % (-1/100)
> '-0.01'

Ehhhh, forgot about that :D Negative numbers and modulo *always* trip
me up, because different languages have different rules. I inevitably
have to go check the docos.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to