1919@test_utils .test (default_fp = qd .f32 , fast_math = True )
2020def test_qd_precise_protects_fast_math ():
2121 """Run Dekker 2Sum twice under `fast_math=True`: once unprotected (the
22- compensation term must be folded to zero -- that is the very bug
22+ compensation term must be folded to zero - that is the very bug
2323 `qd.precise` exists to fix) and once with `qd.precise(...)` wrapping
2424 every FP op (the compensation term must survive).
2525 """
@@ -91,7 +91,7 @@ def df_accum_precise(in_arr: qd.types.ndarray(qd.f32, ndim=1), out: qd.types.nda
9191 # distinguishes `precise` from non-`precise` BinaryOpExpressions. The two kernels are structurally
9292 # identical apart from `qd.precise(...)` wrappers, so if the cache key did not account for `precise`
9393 # (as was the case before), the second compile would silently reuse the first's artifact and
94- # `df_accum_precise` would produce naive behavior -- caught by the final assertion below.
94+ # `df_accum_precise` would produce naive behavior - caught by the final assertion below.
9595 df_accum_naive (in_arr , out_naive )
9696 df_accum_precise (in_arr , out_precise )
9797
@@ -106,12 +106,12 @@ def df_accum_precise(in_arr: qd.types.ndarray(qd.f32, ndim=1), out: qd.types.nda
106106 # `qd.precise` must restore IEEE semantics locally: the compensation term must be non-trivially non-zero.
107107 assert abs (float (lo_precise )) > 1e-10 , (
108108 f"qd.precise failed to protect 2Sum: lo={ lo_precise !r} (expected |lo| > 1e-10). "
109- f"The backend folded `(a - aa) + (b - bb)` to zero -- IEEE-strict ordering was not honored."
109+ f"The backend folded `(a - aa) + (b - bb)` to zero - IEEE-strict ordering was not honored."
110110 )
111111
112112 # And the compensated sum must beat the naive f32 sum by orders of magnitude. This is the end-to-end
113113 # guarantee `qd.precise` exists to provide; it also indirectly validates that the offline-cache key
114- # generator distinguishes `precise` from non-`precise` BinaryOpExpressions -- if it did not, the two
114+ # generator distinguishes `precise` from non-`precise` BinaryOpExpressions - if it did not, the two
115115 # kernels (structurally identical apart from `qd.precise(...)` wrappers) would share a compiled artifact
116116 # and `out_precise` would match `out_naive`.
117117 ds_err = abs (float (hi_precise ) + float (lo_precise ) - expected_f64 )
@@ -135,7 +135,7 @@ def test_qd_precise_unary_rounding():
135135 `fast_math=True` happens to give correctly-rounded transcendentals
136136 anyway and a comparison against it would be uninformative. `sqrt`
137137 is included because LLVM FMF's `afn` can substitute `rsqrt+refine`
138- which is ~2-3 ULP -- the precise tag must defeat that substitution.
138+ which is ~2-3 ULP - the precise tag must defeat that substitution.
139139 """
140140
141141 @qd .kernel
0 commit comments