Hi!

Just a quick question
math.modf(x) is a python function that returns the fractional and integer parts of x. Both results carry the sign of x and are floats.
Therefore, if I write, for instance, 5.4 to the python 2.6.6 command line I think I should get (0.4, 5.0) but I get instead (0.40000000000000036, 5.0).
Is this a bug?

Nope. Floating point arithmetic error.
0.4 cannot be stored as a finite binary number.

Oh, that's true. thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.