Skip to content

Commit a5eecb5

Browse files
authored
Implement round-half-even float.fromhex in common float_ops (#8234)
* Add round-half-even hex float parser to common float_ops Add float_ops::from_hex returning Result<f64, HexFloatError>, which parses the coefficient and exponent, rounds round-half-even over the full exponent range, and detects overflow. Route float.fromhex through it: raise OverflowError for values too large to represent and ValueError for invalid input. Remove the expectedFailure on test_from_hex. Assisted-by: Claude * Address review: Option-returning byte helpers, const fns, drop test_ prefix Assisted-by: Claude * Whitelist fdigits and inity in cspell Assisted-by: Claude * Home is_py_ascii_whitespace in rustpython-wtf8; share with common and sre_engine Assisted-by: Claude * Use shared wtf8 is_py_ascii_whitespace in bytes_inner Remove the private copy of is_py_ascii_whitespace in bytes_inner.rs and import the shared rustpython_common::wtf8::is_py_ascii_whitespace. Assisted-by: Claude
1 parent 0e2c848 commit a5eecb5

7 files changed

Lines changed: 429 additions & 12 deletions

File tree

.cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@
6666
"deoptimize",
6767
"emscripten",
6868
"excs",
69+
"fdigits",
6970
"flufl",
7071
"fnfe",
7172
"fsdefault",
7273
"ifexp",
7374
"implicits",
75+
"inity",
7476
"interps",
7577
"jitted",
7678
"jitting",

Lib/test/test_float.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,6 @@ def test_whitespace(self):
12621262
self.identical(got, expected)
12631263

12641264

1265-
@unittest.expectedFailure # TODO: RUSTPYTHON; ValueError: invalid hexadecimal floating-point string
12661265
def test_from_hex(self):
12671266
MIN = self.MIN
12681267
MAX = self.MAX

0 commit comments

Comments
 (0)