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

Tests for floor function precision errors #26537

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,7 @@ Robin Richard <raisin@ecomail.fr> Nornort <francois.lalleve@laposte.net>
Robin Richard <raisin@ecomail.fr> robinechuca <61911191+robinechuca@users.noreply.github.com>
Robin Richard <raisin@ecomail.fr> robinechuca <raisin@ecomail.fr>
Rodrigo Luger <rodluger@gmail.com>
Rohan Agrawal <rohanagr@umich.edu>
Rohit Jain <rohitjain3241@gmail.com>
Rohit Rango <rohit.rango@gmail.com>
Rohit Sharma <31184621+rohitx007@users.noreply.github.com>
Expand Down
14 changes: 14 additions & 0 deletions sympy/core/tests/test_evalf.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,3 +732,17 @@ def test_issue_20733():
assert srepr(expr.evalf(2, subs={x: 1})) == "Float('4.0271e+2561', precision=10)"
assert srepr(expr.evalf(10, subs={x: 1})) == "Float('4.02790050126e+2561', precision=37)"
assert srepr(expr.evalf(53, subs={x: 1})) == "Float('4.0279005012722099453824067459760158730668154575647110393e+2561', precision=179)"


def test_issue_26368():
assert floor(log(2**30-1,2)+1) == 30
assert floor(log(2**31-1,2)+1) == 31
assert floor(log(2**32-1,2)+1) == 32
assert floor(log(2**40-1,2)+1) == 40
assert floor(log(2**50-1,2)+1) == 50

assert 2**31 == 2**floor(log(2**31-1,2)+1)

assert (1 / floor(log(2**40-1,2)+1)) == 0.025
assert floor(1/2**40) == 0
assert floor (1/2**40) != (1/2**40)
Comment on lines +743 to +748
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these necessary?