From d0529b67f48507ce52ce06305fb2673f5beb2851 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 30 Sep 2005 15:03:33 +0000 Subject: [PATCH] use fmod() to prevent overflow of angle variable --- progs/demos/gears.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/progs/demos/gears.c b/progs/demos/gears.c index 679fac44893..ab9bc007421 100644 --- a/progs/demos/gears.c +++ b/progs/demos/gears.c @@ -234,7 +234,9 @@ idle(void) dt = t - t0; t0 = t; - angle += 70.0 * dt; /* 90 degrees per second */ + angle += 70.0 * dt; /* 70 degrees per second */ + angle = fmod(angle, 360.0); /* prevents eventual overflow */ + glutPostRedisplay(); } -- 2.30.2