Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python floats

Name: Anonymous 2007-02-28 8:06 ID:hNUN74R6

Hey /g/, how do I display a float without ".0" at the end when its value is an integer? Is there a string formatting thing to do this?

Name: Anonymous 2007-03-01 6:23 ID:NmkBTxji

>>14

All integers the width of the mantissa can be represented exactly. And IEEE-754 normalisation rules mean that they will be. So a float can precisely represent integers from -2^24 to 2^24 and a double from -2^53 to 2^53.

So he can safely rely on the test x == (int)x for those ranges.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List