We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a26cfc commit d4d5b4eCopy full SHA for d4d5b4e
quaddtype/numpy_quaddtype/src/ops.hpp
@@ -832,13 +832,12 @@ ld_logaddexp2(const long double *x, const long double *y)
832
return *x;
833
}
834
835
- // Numerically stable computation
836
// log2(2^x + 2^y) = max(x, y) + log2(1 + 2^(-abs(x - y)))
837
long double diff = *x - *y;
838
long double abs_diff = fabsl(diff);
839
long double max_val = (*x > *y) ? *x : *y;
840
- // log2(1 + z) = log(1 + z) / log(2)
841
- return max_val + log1pl(exp2l(-abs_diff)) / M_LN2;
+ // Use native log2l function for base-2 logarithm
+ return max_val + log2l(1.0L + exp2l(-abs_diff));
842
843
844
// comparison quad functions
0 commit comments