diff --git a/samples/sample_determinism.cpp b/samples/sample_determinism.cpp index 1143e7751..7ebc79e59 100644 --- a/samples/sample_determinism.cpp +++ b/samples/sample_determinism.cpp @@ -82,6 +82,10 @@ class FallingHinges : public Sample bodyDef.type = b2_dynamicBody; bodyDef.position = { x + offset * i, h + 2.0f * h * i }; + + // this tests the deterministic cosine and sine functions + bodyDef.rotation = b2MakeRot( 0.01f * i - 0.1f ); + b2BodyId bodyId = b2CreateBody( m_worldId, &bodyDef ); if ((i & 1) == 0) diff --git a/src/math_functions.c b/src/math_functions.c index a53f49487..147708695 100644 --- a/src/math_functions.c +++ b/src/math_functions.c @@ -60,12 +60,14 @@ bool b2Rot_IsValid( b2Rot q ) float b2Sqrt(float x) { -#if defined( B2_CPU_X64 ) || defined( B2_CPU_WASM ) - return _mm_cvtss_f32(_mm_sqrt_ss( _mm_set1_ps(x) )); -#else - float32x4_t v = vdupq_n_f32( x ); - return vgetq_lane_f32( vsqrtq_f32( v ), 0 ); -#endif + return sqrtf( x ); + +//#if defined( B2_CPU_X64 ) || defined( B2_CPU_WASM ) +// return _mm_cvtss_f32(_mm_sqrt_ss( _mm_set1_ps(x) )); +//#else +// float32x4_t v = vdupq_n_f32( x ); +// return vgetq_lane_f32( vsqrtq_f32( v ), 0 ); +//#endif } float b2Length( b2Vec2 v )