Commit Graph

67 Commits

Author SHA1 Message Date
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
Jeong YunWon
801d01161c Refactor PyFloat cmp/op 2019-12-26 22:17:24 +09:00
coolreader18
e8d51a8f4b Fix remaining clippy errors to get master green 2019-12-21 14:51:00 -06:00
coolreader18
08f72686b3 Actually actually make master green 2019-12-21 14:45:33 -06:00
coolreader18
3bf124f364 Actually make master green 2019-12-21 14:44:04 -06:00
coolreader18
8dc6c2bddc Fix remaining clippy errors to get master green 2019-12-21 14:35:37 -06:00
Adolfo Gonzalez III
256f3562c2 Changed to use existing method
Made try_to_bigint public and then used for math.ceil and math.floor
2019-12-02 11:24:18 -06:00
Adolfo Gonzalez III
47daaf555f Rebasing branch 2019-12-02 11:24:18 -06:00
writtic
ed075cf71c Update remainder module of math
- Implement remainder function with test case
  - math.remainder was added to CPython in 3.7 and RustPython CI runs on 3.6
2019-11-11 22:27:46 +09:00
johan.park
533aa2bc26 Update fmod module of math
- Implement fmod function with test case
2019-10-20 14:55:23 +09:00
johan.park
731186a23d Improve modf module of math
- Add INF, NINF, NAN test case
- Apply code relevant to added the test case on the modf code
2019-10-19 10:36:20 +09:00
Johan
6270344740 Update isclose module of math (#1532)
- Implement `math.isclose()` function with test case
  - Add `IsCloseArgs` struct for `keyword_only` argument: `rel_tol`, `abs_tol`
- Change order of test case on `math_module.py` for readability
  - Clippy recommends using `std::f64::EPSILON` instead of `==` but purpose is different
- Fix multiline declaration on the function parameters
2019-10-16 23:25:53 +09:00
Jeong YunWon
6c0f852b62 Refactor pymethod return types to be smaller as possible 2019-10-11 03:27:23 +09:00
johan.park
040c290a6e Apply clippy 2019-09-22 16:27:38 +09:00
johan.park
db10a82cbe Update copysign module of math
- Implement copysign function with test case
- Add constants of NAN, INF, NINF on top of `math_module.py`
2019-09-22 16:12:41 +09:00
Aviv Palivoda
6a6a10afa1 Use IntoPyFloat in math.rs 2019-09-14 12:50:58 +03:00
Marcin Pajkowski
c4db8d6538 Add math.modf function 2019-08-17 23:14:53 +02:00
johan.park
c8d8acdcdf Fix TypeError issue
- Using python reference type instead of arg_check
- Add TypeError assertion on test case
- Add TypeError assertion of frexp method
2019-08-17 00:44:00 +09:00
johan.park
20cb32bf1a Fix code for rustfmt and clippy 2019-08-16 23:10:13 +09:00
johan.park
b38a280ea1 Update ldexp module of math 2019-08-16 23:03:55 +09:00
johan.park
fddbbc701f Fix code for rustfmt and clippy 2019-08-16 17:23:43 +09:00
johan.park
7b5f574847 Change statement from match to if 2019-08-16 14:49:28 +09:00
johan.park
8e8c09ce6b Fix switched comment position 2019-08-16 14:35:43 +09:00
johan.park
48ae9a309d Update factorial module of math
- Implement factorial function with test case
- Deal with Negative input as a ValueError
2019-08-16 14:28:35 +09:00
Windel Bouwman
589c431c8c Merge master branch 2019-08-15 18:59:29 +02:00
Marcin Pajkowski
e65e9ff7c3 Make func_ref an &PyObjectRef 2019-08-15 13:45:47 +02:00
Windel Bouwman
d06dec77ea Attempt to reduce the size of the pyobject.rs files by splitting out builtin types. 2019-08-14 19:08:47 +02:00
yf
7b9d54f77a Add math.gcd 2019-08-08 01:51:46 +08:00
Maxim Kurnikov
8a5182a8a1 make get_method_or_type_error() error message lazy 2019-06-07 16:08:37 +03:00
Maxim Kurnikov
3bfd66bb89 make some exception messages more compatible with CPython, split get_method() into two methods and make raising TypeError more explicit for get_method() errors 2019-06-03 19:46:32 +03:00
Jeong YunWon
d223af645b Add math.frexp 2019-05-17 01:12:43 +09:00
Jeong YunWon
6afe78c9a6 Add math.ceil / math.floor 2019-04-29 04:26:10 +09:00
Jeong YunWon
c3714c2eca Add math.trunc 2019-04-29 04:26:10 +09:00
Darren Kaste
a8e064b1c0 Import TypeProtocol before use in type_check! 2019-04-14 17:19:44 -04:00
Adam Kelly
9ed051e3b7 Module Initialisation takes VirtualMachine rather than PyContext. 2019-04-05 09:50:31 +01:00
coolreader18
a9051ab462 Convert all &mut VirtualMachine to &VirtualMachine 2019-03-22 01:48:14 -05:00
Joey
7bfd2e6e84 Move function items out of pyobject module 2019-03-15 21:27:11 -07:00