Skip to content

Commit ecefabe

Browse files
committed
attempt a floating-point hack
1 parent 9377ab6 commit ecefabe

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Lib/_pydecimal.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,12 @@ def IEEEContext(bits, /):
451451
# See https://github.com/python/cpython/issues/140036 for details.
452452

453453
_LOG_10_BASE_2_LO = float.fromhex('0x1.a934f0979a371p+1')
454+
_LOG_10_BASE_2_LO -= _math.ulp(_LOG_10_BASE_2_LO) * 20
455+
assert _LOG_10_BASE_2_LO > 0
454456
assert pow(2, _LOG_10_BASE_2_LO) < 10
455457

456458
_LOG_10_BASE_2_HI = float.fromhex('0x1.a934f0979a372p+1')
459+
_LOG_10_BASE_2_HI += _math.ulp(_LOG_10_BASE_2_HI) * 20
457460
assert pow(2, _LOG_10_BASE_2_HI) > 10
458461

459462

0 commit comments

Comments
 (0)