SciML / OrdinaryDiffEq.jl

High performance ordinary differential equation (ODE) and differential-algebraic equation (DAE) solvers, including neural ordinary differential equations (neural ODEs) and scientific machine learning (SciML)
https://diffeq.sciml.ai/latest/
Other
521 stars 198 forks source link

test(inplace_interpolation.jl): check for approx equality #2181

Closed characat0 closed 2 months ago

characat0 commented 2 months ago

Checklist

Additional context

Check for approximate equality instead of exact equality.

julia> versioninfo()
Julia Version 1.10.3
Commit 0b4590a5507 (2024-04-30 10:59 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 12 × Apple M2 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 8 default, 0 interactive, 4 GC (on 8 virtual cores)
ChrisRackauckas commented 2 months ago

Why is this needed? What test was this for?

characat0 commented 2 months ago

This test errored in my machine, I've added the specs and since another test in the same file also checks for approx equality I think this might have been what the author had intended

ChrisRackauckas commented 2 months ago

I see. Yes looking at it, it can be dependent on how your CPU gets optimized since SIMD allows for reordering of floating point operations, and (x + y) + z is not equal to x + (y + z) in floating point, and this is the cause of the difference.