8000 [mypyc] Use a native unboxed representation for floats by JukkaL · Pull Request #14880 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

[mypyc] Use a native unboxed representation for floats #14880

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

Merged
merged 56 commits into from
Mar 14, 2023
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
5620f68
[mypyc] Use an unboxed representation for floats
JukkaL Dec 28, 2021
0ea696d
Fix after rebase
JukkaL Dec 31, 2022
3d5f397
Support undefined floats in locals
JukkaL Aug 27, 2022
8954cc9
Support float default args
JukkaL Aug 27, 2022
62abec1
WIP mixed operations test case
JukkaL Aug 31, 2022
c8214d0
Support mixed float/int arithmetic
JukkaL Sep 10, 2022
f222c1f
Add run tests
JukkaL Sep 10, 2022
80ebe04
Add primitive for true divide of int by int (resulting in a float)
JukkaL Sep 10, 2022
8ae9c98
Make float(f) a no-op for float arguments
JukkaL Sep 10, 2022
9d874ce
Fix overflow handling when converting to int
JukkaL Sep 10, 2022
916cda9
WIP float divide by zero test case
JukkaL Sep 10, 2022
3bbc76a
Add some irchecking of int and float ops
JukkaL Sep 11, 2022
c208066
Implement float division and modulus
JukkaL Sep 11, 2022
218def2
Add and improve some math primitives
JukkaL Sep 11, 2022
de5dd64
Improve run tests
JukkaL Sep 11, 2022
c1cdda1
Make +x a no-op for floats
JukkaL Sep 14, 2022
47acc06
Fix float negation
JukkaL Sep 14, 2022
8dbd05a
More tests
JukkaL Sep 24, 2022
fc5cd16
Fix float abs
JukkaL Sep 24, 2022
0b2a642
Add more test cases
JukkaL Sep 24, 2022
1cb15ca
Add primitive for math.exp
JukkaL Sep 24, 2022
987d93e
Add primitive for math.floor
JukkaL Sep 24, 2022
1054d4a
Add primitive for math.ceil
JukkaL Sep 24, 2022
f54e618
Add primitive for math.fabs
JukkaL Sep 24, 2022
d7e044e
Add primitive for math.log
JukkaL Sep 24, 2022
2d3b7a3
Add primitive for math.tan and math primiive run tests
JukkaL Sep 24, 2022
289bc29
Add more float values to test
JukkaL Sep 24, 2022
2de8e0b
Black
JukkaL Sep 24, 2022
2141f4d
Add primitive for float floor division
JukkaL Sep 24, 2022
c98c043
Refactor test cases
JukkaL Sep 24, 2022
40e991a
Add primitive for math.pow
JukkaL Sep 24, 2022
fd117e6
Refactor test case
JukkaL Sep 24, 2022
d721828
Add docstrings
JukkaL Sep 24, 2022
6205767
Fix test cases
JukkaL Dec 31, 2022
9a4db2d
Fix math.pow on Python 3.11
JukkaL Dec 31, 2022
4c89337
Update float to native int conversion tests
JukkaL Jan 27, 2023
71d8568
Update i64 test case
JukkaL Jan 27, 2023
1462b9f
Update test case on Python 3.11 (not sure why this changed)
JukkaL Jan 27, 2023
0d710b1
isort and lint
JukkaL Jan 27, 2023
4b4b7a1
Test coercing from bool to float
JukkaL Jan 28, 2023
72db9fc
Test floats in properties, glue methods and traits
JukkaL Jan 28, 2023
4a4376c
Update test case
JukkaL Mar 4, 2023
bdca8ab
Disallow narrowing a float value to int
JukkaL Mar 11, 2023
cc2aedf
Fix type check
JukkaL Mar 11, 2023
937df67
Add test case
JukkaL Mar 11, 2023
e8e694f
Fix test case
JukkaL Mar 11, 2023
00fd468
Add test case
JukkaL Mar 11, 2023
01f670b
Fix test cases to not assign ints to float variables
JukkaL Mar 11, 2023
6cd75b8
Update test case
JukkaL Mar 11, 2023
6384c03
Add i64 to float conversion test case
JukkaL Mar 11, 2023
a177197
Fix tests on 32-bit architecture
JukkaL Mar 11, 2023
3c5931d
Add missing error check to property getter wrappers
JukkaL Mar 11, 2023
8ab5e25
Work around mypyc bug
JukkaL Mar 11, 2023
e85f057
Work around another issue
JukkaL Mar 11, 2023
e45dba5
Fix test on 3.11
JukkaL Mar 12, 2023
c9d7147
Add subnormal values
JukkaL Mar 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP float divide by zero test case
  • Loading branch information
JukkaL committed Mar 11, 2023
commit 916cda97c1a877c60c7e9af145bf95ee7df7f153
12 changes: 12 additions & 0 deletions mypyc/test-data/run-floats.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def test_arithmetic() -> None:
assert x / 2.0 == 0.75
assert x * (-0.5) == -0.75
assert -x == -1.5
assert x % 0.4 == 0.29999999999999993
assert x % -0.4 == -0.10000000000000009
assert (-x) % 0.4 == 0.10000000000000009
assert (-x) % -0.4 == -0.29999999999999993

def test_mixed_arithmetic() -> None:
zf = float(0.0)
Expand All @@ -27,6 +31,14 @@ def test_mixed_arithmetic() -> None:
x += zn + 2
assert x == 5.4

def test_arithmetic_errors() -> None:
zero = float(0.0)
one = zero + 1.0
with assertRaises(ZeroDivisionError, "float division by zero"):
print(one / zero)
with assertRaises(ZeroDivisionError, "float modulo"):
print(one % zero)

def test_comparisons() -> None:
zero = float(0.0)
one = zero + 1.0
Expand Down
0