Commit 8ff0b7d
committed
gh-NNNN: Use Ryu in double_round() for float.__round__ (ndigits >= 0)
In Objects/floatobject.c, replace the _Py_dg_dtoa() call in
double_round() with _PyRyu_dtoa() for the non-negative ndigits path.
float.__round__(x, k) for k >= 0 now uses Ryu's d2fixed_buffered_n
via the _PyRyu_dtoa mode-3 adapter.
The negative-ndigits path (float.__round__(x, -k)) still uses
_Py_dg_dtoa as there is no Ryu equivalent for that operation.
The returned buffer is freed with PyMem_Free() / _Py_dg_freedtoa()
selected by a buf_uses_pymem flag.1 parent 3325a27 commit 8ff0b7d
1 file changed
+18
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
909 | 912 | | |
910 | 913 | | |
911 | 914 | | |
| 915 | + | |
912 | 916 | | |
913 | 917 | | |
914 | 918 | | |
915 | | - | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
916 | 922 | | |
917 | | - | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
918 | 930 | | |
919 | 931 | | |
920 | 932 | | |
| |||
951 | 963 | | |
952 | 964 | | |
953 | 965 | | |
954 | | - | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
955 | 970 | | |
956 | 971 | | |
957 | 972 | | |
| |||
0 commit comments