Commit Graph

103 Commits

Author SHA1 Message Date
Kim Dong In
1e41a0bb56 apply cargo fmt 2021-08-16 17:16:47 +09:00
Dong In Kim
405fc685bd Update vm/src/stdlib/math.rs
Co-authored-by: Jeong YunWon <youknowone@users.noreply.github.com>

Co-authored-by: Jeong YunWon <youknowone@users.noreply.github.com>
2021-08-16 17:11:47 +09:00
Kim Dong In
6fa88ab05a Fix failed test pow in test_math
add two conditions to raise ValueError for input values
case 1: NaN, when both input values are finite, and base is negative and exponent is non-integer
case 2: divde by zero, when base is 0 exponent is negative value
2021-08-16 16:45:45 +09:00
voidSatisfaction
67ede59c32 Add math.prod function and enable its tests 2021-08-15 23:20:28 +09:00
leesungbin
2c6208a5f8 Add math_perm method
Co-authored-by: Jeong YunWon <youknowone@users.noreply.github.com>
2021-08-11 02:29:44 +09:00
voidSatisfaction
3cd1f6b27c Add math.comb function 2021-08-08 20:04:23 +09:00
Jeong YunWon
ff4efd0f60 Fix unnessessary borrow 2021-07-30 02:32:16 +09:00
Yossi Konstantinovsky
e909f48f7e math: fix ldexp 2021-07-12 10:39:43 +03:00
Yossi Konstantinovsky
963e6e3df6 math: raise OverflowError when result is infinite
Matches CPython behavior.
2021-07-12 10:35:31 +03:00
Noah
3d9812e748 Remove remaining borrow_value() uses 2021-05-20 10:30:42 -05:00
Noah
d6e79fbbbf Replace PyInt.borrow_value() with .as_bigint() 2021-05-20 10:29:48 -05:00
Noah
376ce87b76 Move Either to crate::utils 2021-05-20 10:29:48 -05:00
Noah
99104faaf7 Re-export pyobject::* from the root of the crate 2021-05-20 10:24:07 -05:00
Noah
8ae26e545f Don't depend on num-iter 2021-04-25 18:03:29 -05:00
Zach Silver
9636996c4f Fix floor and ceil functions to match cpython behavior 2021-02-15 16:30:14 -08:00
Noah
75f9ea2f29 Update rand deps, replace statrs with puruspe 2021-01-07 23:44:45 -06:00
carbotaniuman
353f558f67 Format 2020-12-22 16:25:28 -06:00
carbotaniuman
d9b9aea9f5 Address clippy 2020-12-22 11:31:40 -06:00
carbotaniuman
9faed3582a Address review 2020-12-21 22:29:15 -06:00
carbotaniuman
0ff37540ab Add fsum to the math module 2020-12-19 19:32:08 -06:00
carbotaniuman
c478c64e2e Fix complex() and float() to user dunder methods
This also adds a `to_op_X` method in order to make arithmetic operations work due to the changes in `try_X`
2020-11-11 13:56:29 -06:00
Noah
7beb932563 Distinguish between to_index and to_index_opt 2020-11-06 11:11:06 -06:00
hyperbora
babebf0794 fix math.acosh 2020-10-31 00:26:18 +09:00
Noah
e772b42f36 Fix a few math tests and implement nextafter in rust 2020-10-25 13:43:33 -05:00
Árni Dagur
da2bd5ea86 Implement math.ulp 2020-10-21 23:41:47 +00:00
Jeong YunWon
19ed4f85e7 clean up vm::builtins 2020-10-13 15:42:11 +09:00
Jeong YunWon
9e6dfca9e9 Fix build with new builtins path 2020-10-11 21:16:16 +09:00
Jeong YunWon
b0445396f4 compactize invoke args 2020-10-11 09:38:06 +09:00
Jeong YunWon
a089c9b6d3 TypeProcotol::lease_class() -> TypeProtocol::class() 2020-10-11 09:11:58 +09:00
Jeong YunWon
6e60915f46 more lease_class 2020-10-11 00:37:08 +09:00
Árni Dagur
72608545f3 Implement math.isqrt in Rust 2020-10-06 17:58:58 +00:00
hyperbora
c6ea8f9907 fix math.acos and math.asin 2020-10-03 22:37:43 +09:00
hyperbora
a1437a5be5 fix math.sqrt 2020-10-03 12:37:07 +09:00
Noah
acd0bf5434 Make the FromArgs derive less verbose 2020-10-01 17:42:07 -05:00
Noah
ca5f2da9e9 Make more builtin functions be named 2020-09-21 10:32:25 -05:00
Jeong YunWon
0cb4d8a22a cleanup wasm build warnings 2020-09-15 04:03:14 +09:00
Jeong YunWon
bd3d4cfdb2 earlier returning for error 2020-08-23 06:54:25 +09:00
Jeong YunWon
7a8045fea1 BorrowValue for PyInt and PyList 2020-08-09 13:44:31 +09:00
Noah
0251f3e9a2 Move pyhash and some float ops to rustpython-common 2020-07-25 15:22:00 -04:00
Ben Lewis
fe347370c6 Avoid cloning within isinstance/issubclass calls. 2020-07-12 09:12:41 +12:00
Ben Lewis
0cd78fbc88 Replace more usages of .class() with .lease_class(). 2020-07-12 09:12:41 +12:00
TheAnyKey
b7e91677a7 simplified implementation and commented tests 2020-05-10 20:53:09 +00:00
TheAnyKey
d3dafda7c2 Implement LCM and GCD from Py3.9; merged from TheAnyKey/p39_math 2020-05-08 16:31:36 +00:00
Jeong YunWon
1c6808748e Fix struct pack and unpack 2020-03-04 11:42:17 +09:00
Jeong YunWon
6ddb690e09 Remove _vm parameter when it is not required 2020-02-06 11:07:51 +09:00
Jeong YunWon
1bac582921 &str::to_string -> &str::to_owned for literals 2020-02-05 22:55:33 +09:00
Noah
e10a8b282d Use new_function for nextafter to fix CI 2020-01-13 11:01:44 -06:00
Jeong YunWon
c4d1ad346b Merge pull request #1679 from corona10/math_nextafter
math: Implement math.nextafter
2020-01-13 20:18:16 +09:00
Dong-hee Na
1de9b1a41d math: Implement math.nextafter 2020-01-13 02:03:02 +09:00
Jeong YunWon
70b63eb758 new_rustfunc -> new_function & new_method to distinguish bindable functions 2020-01-12 18:39:16 +09:00