Noah
97c8d11092
Make PyResult<T> = Result<T, PyBaseExceptionRef>
2019-12-27 11:22:52 -06:00
Jeong YunWon
00b0a8abfe
PyObject::payload_if_subclass
2019-12-25 19:11:07 +09:00
Jeong YunWon
0932d6912d
refactor PyInt
2019-12-15 23:15:37 +09:00
Jeong YunWon
a7bee70685
objint::get_float_value -> objfloat::from_int_value
...
because objint::get_float_value is only used in objfloat
2019-12-15 23:15:37 +09: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
johan.park
bbd274a498
Improve float.fromhex module representation case
...
- Embrace hexadecimal without '0x', '.', 'p'
- Embrace variety of 'nan', 'inf' case
- Still overflow and near min, max, 0, 1 case isn't handled
2019-11-03 02:06:44 +09:00
Johan
40a22f217d
Improve float.fromhex module of objfloat ( #1552 )
...
* Improve float.fromhex module of objfloat
- Python float.fromhex can handle string of float and hex without `.`
- For example '0.0', '-0.0', '0x0p0', '-0x0p0'
- Add test case mantioned
* Change unwrap to expect for error handling
* Improve error handling with pattern matching
- `expect` that can't express python vm error message changed to pattern match
- Erase duplicated test case
* Refactoring with or_else and map_err
- Use `or_else` instead of value condition and `match` statement
- For floating-point input
- Use `map_err` instead of `match ` statement
- For hexadecimal floating-point input without dot
* Add else condition
2019-10-31 19:54:28 +01:00
HyeockJinKim
ed8573e2a6
Modify str to float
...
Fix to receive a string value with '_' when creating a float value
Fixes #1527
2019-10-26 14:19:30 +09:00
ChJR
814018f7b6
Fix float.__repr__() method
2019-10-20 17:49:39 +09:00
Aviv Palivoda
37f01fd9ae
Simeplify float.__round__
2019-10-17 17:47:38 +03:00
Seo Sanghyeon
6887365092
Update lexical to 4
2019-10-15 21:40:59 +09:00
Windel Bouwman
6f624c6f95
Merge pull request #1521 from janrg/round_to_n_decimals
...
Implement round(number, digits) for digits != 0
2019-10-14 20:19:40 +02:00
janrg
4fd38e6220
Add test snippets, fix rounding for very small numbers
2019-10-14 17:06:07 +02:00
Noah
d42d422566
Merge pull request #1505 from youknowone/defer-new-int-clone
...
Defer BigInt::clone() for new_int
2019-10-13 14:27:37 -05:00
janrg
122aa96887
Fix linter errors
2019-10-13 14:09:17 +02:00
janrg
458fa3cb7b
Fix formatting
2019-10-13 13:22:19 +02:00
janrg
b858ae8776
Implement round(number, digits) for digits != 0
2019-10-13 13:04:24 +02:00
Jeong YunWon
6c0f852b62
Refactor pymethod return types to be smaller as possible
2019-10-11 03:27:23 +09:00
Jeong YunWon
dc09fb7539
Defer BigInt::clone() for new_int
2019-10-11 00:40:31 +09:00
HyeockJinKim
37e85df527
Add __ne__ for float
...
Issue #1442
2019-10-10 03:49:13 +09:00
Jeong YunWon
2153ebbc23
Fix pow(0, exp) with negative exp to raise ZeroDivisionError
2019-10-05 00:04:31 +09:00
Noah
9ed825742c
Revert " Fix argument keyword error in int/float/bool.__new__"
2019-10-02 21:33:43 -05:00
Sang-Heon Jeon
49577e0713
Merge branch 'master' into fix-int-arg
2019-10-02 15:19:01 +09:00
lntuition
a209169d9c
Fix argument keyword error in float.__new__
...
Add FloatArgs struct to fix argument keyword error in float.__new
2019-10-02 15:13:45 +09:00
Noah
d22cac2dd8
Rename new slots to tp_new
2019-09-29 23:14:37 -05:00
coolreader18
c46b5b50bd
Fix weirdness with type.__new__()/type()/metaclass.__new__()
2019-09-29 23:14:31 -05:00
Daniel Alley
32b4a9255f
Allow float() to be called without an argument
...
closes #1421
2019-09-26 22:54:47 -04:00
Noah
00a0e455f3
Merge pull request #1387 from RustPython/coolreader18/string-hash-field
...
Add a hash field to PyString á la CPython, make PyString.value private
2019-09-21 17:15:17 -05:00
MinJeong Kim
6e7e6ecfce
Fix the ValueError for whitespace in float()
...
Ignore whitespace
Fixed : #1391
2019-09-20 18:21:15 +00:00
Noah
0def37d78e
Make PyString.value private
2019-09-19 17:45:48 -05:00
tsvankay
5b2158ab18
fixed __repr__ return value for -0.0
2019-09-18 01:03:29 +09:00
Aviv Palivoda
a5026eded0
Use IntoPyFloat in complex
2019-09-14 12:55:22 +03:00
Aviv Palivoda
6a6a10afa1
Use IntoPyFloat in math.rs
2019-09-14 12:50:58 +03:00
coolreader18
825ee4bc7c
Fix tests/clippy
2019-08-23 17:52:38 -05:00
coolreader18
b8eba6abe3
Add the array module
2019-08-23 17:34:52 -05:00
Windel Bouwman
32634b2d53
Merge pull request #1080 from JimJeon/feature/round
...
Feature/round
2019-08-15 19:50:52 +02: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
JimJeon
befb9a239e
Add round feature for objfloat when ndigits is 0
2019-08-15 16:16:40 +09: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
JimJeon
be887526c1
Fix implements of round
...
- Fix implements when ndigits argument of builtin_round is None
- Fix implements when ndigits argument of float_round is 0
2019-07-18 11:18:18 +09:00
coolreader18
2c65988ea7
Switch to hexf_parse
2019-07-11 18:53:47 -05:00
Maxim Kurnikov
347d48198e
fix remaining clippy warnings
2019-07-07 06:27:07 +03:00
silmeth
d0de3be2a9
fix float–int cross-type comparisons
...
Fixes #1069
2019-06-29 16:50:09 +02: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
Maxim Kurnikov
bc35a64e54
fix most of clippy warnings
2019-06-01 03:19:22 +03:00
coolreader18
9888d27e61
Merge pull request #981 from youknowone/frexp
...
Add math.frexp
2019-05-16 21:37:34 -05:00
Jeong YunWon
ca912a168d
Add float.to_hex
2019-05-17 03:24:31 +09:00
Jeong YunWon
ceca2ed98e
Add float.fromhex
2019-05-17 02:35:39 +09:00