Binary/octal/hexadecimal string support#414
Binary/octal/hexadecimal string support#414warnerjon12 wants to merge 3 commits intompmath:masterfrom
Conversation
|
I still need to add some tests for the new stuff and debug. This is not quite ready yet, but if you have any comments, feel free to state them. If anyone else wants to add tests for this, I am open to that as well. |
146ff70 to
c2711ea
Compare
|
I have not reviewed everything yet, but a first observation is that all the convenience methods are unnecessary. This is not user-facing code. The extra base keyword argument to A small optimization: in the line |
This is a response to issue mpmath#345. Also note that the functions to_bstr and from_bstr have been replaced by to_str_p2 (along with to_bin) and from_bin
b9fe7a5 to
91ef47e
Compare
|
I removed some of the convenience methods and did a few other things. Still need to add more tests |
|
At least all of the regular tests pass now |
…into HexRepresentation345
|
@warnerjon12, could you merge the master branch to trigger CI build? |
| to_digits_exp, to_str, to_bin, to_oct, to_hex, str_to_man_exp, | ||
| from_str, from_bin, from_oct, from_hex, mpf_sqrt, mpf_hypot) |
There was a problem hiding this comment.
As it was noted by Fredrik, there is no need for additional methods
|
|
||
| def to_str(s, dps, strip_zeros=True, min_fixed=None, max_fixed=None, | ||
| show_zero_exponent=False): | ||
| def to_str(s, ps, strip_zeros=True, min_fixed=None, max_fixed=None, |
There was a problem hiding this comment.
Why? In fact, this is an API change: to_str() seems to be a public function.
|
There are test failures with gmpy2. |
| """Helper function for from_str.""" | ||
| x = x.lower().rstrip('l') | ||
| # Verify that the input is a valid float literal | ||
| float(x) |
There was a problem hiding this comment.
This will not work for hexadecimal strings.
base=2**n and base=10 are supported so far. to/from_bstr() undocumented helper functions are removed. Partially taken from mpmath#414. Co-authored-by: Jonathan Warner <[email protected]>
base=2**n and base=10 are supported so far. to/from_bstr() undocumented helper functions are removed. Partially taken from mpmath#414. Co-authored-by: Jonathan Warner <[email protected]>
base=2**n and base=10 are supported so far. to/from_bstr() undocumented helper functions are removed. Partially taken from mpmath#414. Co-authored-by: Jonathan Warner <[email protected]>
base=2**n and base=10 are supported so far. float(), float.fromhex() and MPFR's style (see mpfr_strtofr() function) string formats are accepted. to/from_bstr() undocumented helper functions were removed. Partially taken from mpmath#414. Co-authored-by: Jonathan Warner <[email protected]>
|
Ok, #703 will include Lets close this stale pr. Feel free to address pr review comments and re-open the pr. |
base=2**n and base=10 are supported so far. float(), float.fromhex() and MPFR's style (see mpfr_strtofr() function) string formats are accepted. to/from_bstr() undocumented helper functions were removed. Partially taken from mpmath#414. Co-authored-by: Jonathan Warner <[email protected]>
base=2**n and base=10 are supported so far. float(), float.fromhex() and MPFR's style (see mpfr_strtofr() function) string formats are accepted. to/from_bstr() undocumented helper functions were removed. Partially taken from mpmath#414. Co-authored-by: Jonathan Warner <[email protected]>
base=2**n and base=10 are supported so far. float(), float.fromhex() and MPFR's style (see mpfr_strtofr() function) string formats are accepted. to/from_bstr() undocumented helper functions were removed. Partially taken from mpmath#414. Co-authored-by: Jonathan Warner <[email protected]>
Adapted from mpmath#414. Closes mpmath#345 Co-authored-by: Sergey B Kirpichev <[email protected]> * this version doesn't touch argument names (dps->ps) * no support for float.hex()-style binary exponents
Adapted from mpmath#414. Closes mpmath#345 Co-authored-by: Sergey B Kirpichev <[email protected]> * this version doesn't touch argument names (dps->ps) * no support for float.hex()-style binary exponents
Adapted from mpmath#414. Partial fix for mpmath#345 Co-authored-by: Sergey B Kirpichev <[email protected]> * this version doesn't touch argument names (dps->ps) * no support for float.hex()-style binary exponents
Adapted from mpmath#414. Partial fix for mpmath#345 Co-authored-by: Sergey B Kirpichev <[email protected]> * this version doesn't touch argument names (dps->ps) * no support for float.hex()-style binary exponents
Response to issue #345.
Closes #345