From: Omari S. <xs...@cs...> - 2009-07-22 04:26:58
|
Martin Ling wrote: > On Mon, Jul 20, 2009 at 10:51:30PM +0200, Frank van Maarseveen wrote: >> Regarding the 180 degree patch: I'd write >> >> data->unnormalized_angle = fmod(data->unnormalized_angle, 360.0); >> >> instead of >> >> data->unnormalized_angle -= (360.0 * trunc(data->unnormalized_angle / 360.0)); > > Good point. Actually the whole lot can go in one statement, if we don't > mind normalising +/-180 to -180 rather than +180 as in the previous: > > data->unnormalized_angle = > fmod((data->unnormalized_angle + 180.0) / 360.0) - 180.0; Do you mean fmod(data->unnormalized_angle + 180.0, 360.0) - 180.0; ? fmod takes two arguments. --xsdg |