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

Function measure_cos

tests/fl/math/fixed_point.cpp:1404–1421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1402}
1403
1404AccuracyResult measure_cos() {
1405 AccuracyResult r = {};
1406 const int N = 10; // Spot testing: 10 key points covers full cycle (was 100)
1407 const float lo = -6.2831853f;
1408 const float hi = 6.2831853f;
1409 float sumErr = 0;
1410 for (int i = 0; i < N; ++i) {
1411 float x = lo + (hi - lo) * i / (N - 1);
1412 float ref = fl::cosf(x);
1413 float got = s16x16::cos(s16x16(x)).to_float();
1414 float err = fl::fabsf(got - ref);
1415 sumErr += err;
1416 if (err > r.maxErr) { r.maxErr = err; r.worstInput = x; }
1417 }
1418 r.avgErr = sumErr / N;
1419 r.nSamples = N;
1420 return r;
1421}
1422
1423AccuracyResult measure_atan() {
1424 AccuracyResult r = {};

Callers 1

FL_TEST_FILEFunction · 0.85

Calls 5

cosfFunction · 0.85
fabsfFunction · 0.85
cosFunction · 0.50
s16x16Class · 0.50
to_floatMethod · 0.45

Tested by

no test coverage detected