mirror of
https://github.com/pocketpy/pocketpy
synced 2025-11-05 11:10:17 +00:00
Compare commits
No commits in common. "8ff60df158d07423c3e144485343befffbbaf0bf" and "2d682b24d8a6d8bb164e84a4cd455c4fa80be265" have entirely different histories.
8ff60df158
...
2d682b24d8
@ -70,7 +70,6 @@ static bool int__truediv__(int argc, py_Ref argv) {
|
|||||||
py_i64 lhs = py_toint(&argv[0]);
|
py_i64 lhs = py_toint(&argv[0]);
|
||||||
py_f64 rhs;
|
py_f64 rhs;
|
||||||
if(try_castfloat(&argv[1], &rhs)) {
|
if(try_castfloat(&argv[1], &rhs)) {
|
||||||
if(rhs == 0.0) return ZeroDivisionError("float division by zero");
|
|
||||||
py_newfloat(py_retval(), lhs / rhs);
|
py_newfloat(py_retval(), lhs / rhs);
|
||||||
} else {
|
} else {
|
||||||
py_newnotimplemented(py_retval());
|
py_newnotimplemented(py_retval());
|
||||||
@ -83,7 +82,6 @@ static bool float__truediv__(int argc, py_Ref argv) {
|
|||||||
py_f64 lhs = py_tofloat(&argv[0]);
|
py_f64 lhs = py_tofloat(&argv[0]);
|
||||||
py_f64 rhs;
|
py_f64 rhs;
|
||||||
if(try_castfloat(&argv[1], &rhs)) {
|
if(try_castfloat(&argv[1], &rhs)) {
|
||||||
if(rhs == 0.0) return ZeroDivisionError("float division by zero");
|
|
||||||
py_newfloat(py_retval(), lhs / rhs);
|
py_newfloat(py_retval(), lhs / rhs);
|
||||||
} else {
|
} else {
|
||||||
py_newnotimplemented(py_retval());
|
py_newnotimplemented(py_retval());
|
||||||
|
|||||||
@ -54,19 +54,8 @@ assert eq(float("123.456"), 123.456)
|
|||||||
|
|
||||||
|
|
||||||
inf = float("inf")
|
inf = float("inf")
|
||||||
|
assert 1/0 == inf
|
||||||
try:
|
assert -1/0 == -inf
|
||||||
assert 1/0 == inf
|
|
||||||
exit(1)
|
|
||||||
except ZeroDivisionError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
assert -1/0 == -inf
|
|
||||||
exit(1)
|
|
||||||
except ZeroDivisionError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
assert 1/inf == 0
|
assert 1/inf == 0
|
||||||
assert -1/inf == 0
|
assert -1/inf == 0
|
||||||
|
|
||||||
|
|||||||
@ -8,8 +8,6 @@ def test(data: bytes):
|
|||||||
compressed = lz4.compress(data)
|
compressed = lz4.compress(data)
|
||||||
decompressed = lz4.decompress(compressed)
|
decompressed = lz4.decompress(compressed)
|
||||||
assert data == decompressed
|
assert data == decompressed
|
||||||
if len(data) == 0:
|
|
||||||
return 0
|
|
||||||
return len(compressed) / len(data)
|
return len(compressed) / len(data)
|
||||||
|
|
||||||
test(b'')
|
test(b'')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user