File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 55 */
66#include "fmath.h"
77#include "debug.h"
8+ #include "utils.h"
89#include <string.h>
910#include <stdint.h>
1011
11- /// Mark a branch as likely to be taken
12- #define LIKELY (x ) __builtin_expect((x),1)
13-
1412static const float pi_hi = 3.14159274e+00f ; // 0x1.921fb6p+01
1513static const float pi_lo = -8.74227766e-08f ; // -0x1.777a5cp-24
1614static const float half_pi_hi = 1.57079637e+0f ; // 0x1.921fb6p+0
@@ -42,7 +40,12 @@ float fm_sinf_approx(float x, int approx) {
4240 // very accurate for large numbers, so it will introduce more error compared
4341 // to the 5 ULP figure.
4442 x = fm_fmodf (x + pi_hi , 2 * pi_hi ) - pi_hi ;
45- return sinf_approx (x , approx );
43+ x = sinf_approx (x , approx );
44+ // FIXME: workaround for a bug in our sinf approximation. We found at least
45+ // one input (0xbfc915a2 => -1.570973) that produces an out of bounds result
46+ // -1.000000119209289551 (0xbf800001).
47+ x = CLAMP (x , -1.0f , 1.0f );
48+ return x ;
4649}
4750
4851float fm_sinf (float x ) {
You can’t perform that action at this time.
0 commit comments