I'm the maintainer of Chipmunk2D ffi and my github PR was skipped during the move of the project.
Problem:
The sleeping mechanism froze when enabled because -ffast-math (enabled by default in Release builds) optimizes away direct INFINITY comparisons, causing (sleepTimeThreshold != INFINITY) to always evaluate incorrectly.
Solution:
Replaced all INFINITY comparisons with isfinite()/isinf() across the codebase:
cpSpaceComponent.c: Fixed sleep check in cpSpaceProcessComponents
cpBody.c: Fixed mass and idle time checks
cpSpaceStep.c: Fixed collision filtering
cpBB.h: Fixed segment intersection check
ChipmunkDemo.c: Fixed kinetic energy and point query checks
I'm the maintainer of [Chipmunk2D ffi](https://pub.dev/packages/chipmunk2d_physics_ffi/versions) and my github PR was skipped during the move of the project.
**Problem:**
The sleeping mechanism froze when enabled because -ffast-math (enabled by default in Release builds) optimizes away direct INFINITY comparisons, causing (sleepTimeThreshold != INFINITY) to always evaluate incorrectly.
**Solution:**
Replaced all INFINITY comparisons with isfinite()/isinf() across the codebase:
cpSpaceComponent.c: Fixed sleep check in cpSpaceProcessComponents
cpBody.c: Fixed mass and idle time checks
cpSpaceStep.c: Fixed collision filtering
cpBB.h: Fixed segment intersection check
ChipmunkDemo.c: Fixed kinetic energy and point query checks