Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing


  • 3 years ago

I am new to this course. In lecture 4 at 6:28, I am using Python 2.7.3, when I enter x = 0.1, when I enter x, my answer is what I expect, 0.1, not the .100000000000000001 answer on the video. Is it simply because I am using this version?: Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32 I ask because I worry when I get something different and don't know why.

  • This Question is Closed
  1. Insight
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I found the answer myself from looking at the link clipped from the bottom, which precisely answers my question: meaning that the exact number stored in the computer is approximately equal to the decimal value 0.100000000000000005551115123125. In versions prior to Python 2.7 and Python 3.1, Python rounded this value to 17 significant digits, giving ‘0.10000000000000001’. In current versions, Python displays a value based on the shortest decimal fraction that rounds correctly back to the true binary value, resulting simply in ‘0.1’.

  2. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy