Skip to content

Templated vectorizable Fast RSQRT

Florian Lemaitre requested to merge flemaitr_fast_math into master

Provides a fast reciprocal square root that is templated, and vectorizable.

Usage:

#include "LHCbMath/FastMaths.h"

float a = LHCb::Math::rsqrt<LHCb::Math::fastest>(2.f);

using namespace LHCb::Math;
float b = rsqrt<fastest>(3.f);

It works with float, double, intrinsic SIMD types and any numerical type.

5 variants exist:

rsqrt<accurate>(x); // best accuracy efficiently possible usually the same as ieee
rsqrt<ieee    >(x); // same as 1/sqrt(x) (with intermediate perfect rounding): use for reproducible results
rsqrt<fast    >(x); // usually less then 2 bits of error
rsqrt<faster  >(x); // good estimation
rsqrt<fastest >(x); // rough estimation

For more information, please refer to the documentation

Edited by Marco Cattaneo

Merge request reports

Loading