Skip to content

Commit f2d1fc3

Browse files
committed
test that t1-t0 > 100 ULP's
1 parent e8efca1 commit f2d1fc3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

diffrax/_integrate.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ def loop(
303303
t1_clip_floor = t1
304304
for _ in range(100):
305305
t1_clip_floor = eqxi.prevbefore(t1_clip_floor)
306+
if jnp.sign(t1_clip_floor - t0) != jnp.sign(t1 - t0):
307+
raise ValueError(
308+
"t0 and t1 are within 100 units of least precision "
309+
"implying a high risk of floating point error. Aborting."
310+
)
306311

307312
if saveat.dense:
308313
dense_ts = init_state.dense_ts

0 commit comments

Comments
 (0)