MCPcopy Create free account
hub / github.com/defold/defold / recip_est1

Method recip_est1

engine/dlib/src/basis/encoder/cppspmd_math.h:341–354  ·  view source on GitHub ↗

positive values only

Source from the content-addressed store, hash-verified

339
340// positive values only
341CPPSPMD_FORCE_INLINE vfloat spmd_kernel::recip_est1(const vfloat& q)
342{
343 //const int mag = 0x7EF312AC; // 2 NR iters, 3 is 0x7EEEEBB3
344 const int mag = 0x7EF311C3;
345 const float fMinThresh = .0000125f;
346
347 vfloat l = spmd_ternaryf(q >= fMinThresh, q, cast_vint_to_vfloat(vint(mag)));
348
349 vint x_l = vint(mag) - cast_vfloat_to_vint(l);
350
351 vfloat rcp_l = cast_vint_to_vfloat(x_l);
352
353 return rcp_l * vfnma(rcp_l, q, 2.0f);
354}
355
356CPPSPMD_FORCE_INLINE vfloat spmd_kernel::recip_est1_pn(const vfloat& t)
357{

Callers

nothing calls this directly

Calls 5

spmd_ternaryfFunction · 0.85
cast_vint_to_vfloatFunction · 0.85
vintClass · 0.85
cast_vfloat_to_vintFunction · 0.85
vfnmaFunction · 0.85

Tested by

no test coverage detected