Skip to content

Commit

Permalink
Use even rounding in sin/cos (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdjogoTT authored Oct 15, 2024
1 parent 7592e7b commit 56ec2f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/inc/sfpu/ckernel_sfpu_trigonometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ inline void _calculate_sine_(const int iterations)
{
vFloat v = dst_reg[0];
v = 0.318309886183791f*v; // *1/pi to get number of pi rads.
vInt whole_v = float_to_int16(v);
vInt whole_v = float_to_int16(v, 0);
vFloat whole_v_float = int32_to_float(whole_v, 0);
v = v - whole_v_float;
v *= 3.141592653589793f; // fractional * pi to get it in [-pi:pi]
Expand All @@ -105,7 +105,7 @@ inline void _calculate_cosine_(const int iterations)
{
vFloat v = dst_reg[0];
v = 0.318309886183791f*v; // *1/pi to get number of pi rads.
vInt whole_v = float_to_int16(v);
vInt whole_v = float_to_int16(v, 0);
vFloat whole_v_float = int32_to_float(whole_v, 0);
v = v - whole_v_float;
v *= 3.141592653589793f; // fractional * pi to get it in [-pi:pi]
Expand Down

0 comments on commit 56ec2f5

Please sign in to comment.