summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-03-27 17:15:59 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-03-27 17:15:59 (EDT)
commit02c198574420b8832c4bf9741f38e1928a346286 (patch)
tree36e82227f3cc2107b971b91af2faf4e672646953
parentad5bb828321f7a4f0fe15a4505f1c85a7e1acc04 (diff)
downloaddodge-balls-02c198574420b8832c4bf9741f38e1928a346286.zip
dodge-balls-02c198574420b8832c4bf9741f38e1928a346286.tar.gz
dodge-balls-02c198574420b8832c4bf9741f38e1928a346286.tar.bz2
ball: Fix floating-point remainder arithmetic
-rw-r--r--src/ball.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ball.c b/src/ball.c
index a7ed27e..5b9fda5 100644
--- a/src/ball.c
+++ b/src/ball.c
@@ -101,7 +101,7 @@ _db_ball_bounce(struct db_ball *ball, double col_x, double col_y)
double col_a;
col_a = atan2(col_y - ball->y, col_x - ball->x) * 180 / M_PI;
- ball->a = (2 * col_a - ball->a - 180) % 360;
+ ball->a = fmod(2 * col_a - ball->a - 180, 360);
}
void