2

I am using the following code to convert the string into a float.,

number = "2.05"
float_val = float(number)
print(float_val)

When I run this code with Python 3.5.2, the output is as shown below enter image description here

I am running the same code on a different machine with Python 3.5.1, the output is as follows enter image description here

My expected output is as in Python 3.5.2. What should be done?

Thanks in advance

sam
  • 149
  • 3
  • 11
  • 3
    I get the first output in 3.6.3. The difference is probably more due to the machine or OS, not the Python version. Maybe one is 32-bit the other is 64-bit? – Barmar May 23 '19 at 15:23
  • @Barmar Machine with 3.5.2 is x64 and the one with 3.5.1 is arm – sam May 23 '19 at 15:26
  • 1
    So, yeah, different architectures, slight differences in float handling… – deceze May 23 '19 at 15:28

0 Answers0