webpage icon indicating copy to clipboard operation
webpage copied to clipboard

Fix the python output in "Floating Point Numbers" section in "Python Fortran Rosetta Stone" page

Open Zhou-Jiangcheng opened this issue 1 year ago • 2 comments

Fixed the Python output in the "Floating Point Numbers" section in the explanatory notes.

Zhou-Jiangcheng avatar Sep 08 '24 12:09 Zhou-Jiangcheng

图片 The result in Python cell, in line 4 f = float(1 / 2) # 0.0 seems wrong in Python 3.11, numpy 1.26.4. It should be 0.5. And I also tried float32(1/2), it returns the same result.

Zhou-Jiangcheng avatar Sep 08 '24 12:09 Zhou-Jiangcheng

f = float(1 / 2) # 0.0 seems wrong in Python 3.11, numpy 1.26.4. It should be 0.5.

Yes, it was correct in Python 2, but for Python 3 the behavior of / for two ints changed.

zmoon avatar Sep 09 '24 22:09 zmoon