MCPcopy Create free account
hub / github.com/numpy/numpy / npyv_div_f32

Function npyv_div_f32

numpy/core/src/common/simd/neon/arithmetic.h:217–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215 #define npyv_div_f32 vdivq_f32
216#else
217 NPY_FINLINE npyv_f32 npyv_div_f32(npyv_f32 a, npyv_f32 b)
218 {
219 // Based on ARM doc, see https://developer.arm.com/documentation/dui0204/j/CIHDIACI
220 // estimate to 1/b
221 npyv_f32 recipe = vrecpeq_f32(b);
222 /**
223 * Newton-Raphson iteration:
224 * x[n+1] = x[n] * (2-d * x[n])
225 * converges to (1/d) if x0 is the result of VRECPE applied to d.
226 *
227 * NOTE: at least 3 iterations is needed to improve precision
228 */
229 recipe = vmulq_f32(vrecpsq_f32(b, recipe), recipe);
230 recipe = vmulq_f32(vrecpsq_f32(b, recipe), recipe);
231 recipe = vmulq_f32(vrecpsq_f32(b, recipe), recipe);
232 // a/b = a*recip(b)
233 return vmulq_f32(a, recipe);
234 }
235#endif
236#define npyv_div_f64 vdivq_f64
237

Callers 2

npyv_ifdiv_f32Function · 0.85
npyv_recip_f32Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected