MCPcopy Create free account
hub / github.com/FastLED/FastLED / measure_acos_t

Function measure_acos_t

tests/fl/math/fixed_point.cpp:1770–1787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1768
1769template <typename T>
1770AccuracyResult measure_acos_t() {
1771 AccuracyResult r = {};
1772 const int N = 10; // Spot testing: 10 key points adequate for [-1, 1] range (was 50)
1773 const float lo = -1.0f;
1774 const float hi = 1.0f;
1775 float sumErr = 0;
1776 for (int i = 0; i < N; ++i) {
1777 float x = lo + (hi - lo) * i / (N - 1);
1778 float ref = fl::acosf(x);
1779 float got = T::acos(T(x)).to_float();
1780 float err = fl::fabsf(got - ref);
1781 sumErr += err;
1782 if (err > r.maxErr) { r.maxErr = err; r.worstInput = x; }
1783 }
1784 r.avgErr = sumErr / N;
1785 r.nSamples = N;
1786 return r;
1787}
1788
1789template <typename T>
1790AccuracyResult measure_sqrt_t() {

Callers

nothing calls this directly

Calls 5

acosfFunction · 0.85
acosFunction · 0.85
TEnum · 0.85
fabsfFunction · 0.85
to_floatMethod · 0.45

Tested by

no test coverage detected