Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Zhou-Jiangcheng
Copy link

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

Fixed the Python output in the "Floating Point Numbers" section in the explanatory notes.
@Zhou-Jiangcheng
Copy link
Author

图片
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 Zhou-Jiangcheng changed the title fix the python output in floating section in "Python Fortran Rosetta Stone" page Fix the python output in floating section in "Python Fortran Rosetta Stone" page Sep 8, 2024
@Zhou-Jiangcheng Zhou-Jiangcheng changed the title Fix the python output in floating section in "Python Fortran Rosetta Stone" page Fix the python output in "Floating Point Numbers" section in "Python Fortran Rosetta Stone" page Sep 8, 2024
@zmoon
Copy link
Member

zmoon commented Sep 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants