FastLED 3.10.6
Loading...
Searching...
No Matches

◆ roundedDivI64()

i64 fl::anonymous_namespace{device_solve.cpp.hpp}::roundedDivI64 ( i64 numerator,
i64 denominator )

Nearest integer, halves away from zero.

Truncating would bias every coefficient toward zero, and the bias does not cancel across a row – a solve is a sum of three of them.

Definition at line 81 of file device_solve.cpp.hpp.

81 {
82 if (denominator < 0) {
83 numerator = -numerator;
84 denominator = -denominator;
85 }
86 const i64 half = denominator / 2;
87 if (numerator >= 0) {
88 return (numerator + half) / denominator;
89 }
90 return -((-numerator + half) / denominator);
91}
fl::i64 i64
Definition stdint.h:221

References fl::FL_NO_EXCEPT, and roundedDivI64().

Referenced by divideCoefficientQ16(), and roundedDivI64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: