Re: Converting floats to a specific range

Danny Kodicek <[email protected]> Fri, 7 May 2010 13:35:36 +0100
Newsgroups gmane.games.devel.algorithms
Message-ID <[email protected]>
>
> There's a standard C library function, fmod, that nearly does what you

want. The one thing you need to fix is that fmod(x, wrapSize) is

negative whenever x is. So the solution to your problem is


A quick unlurk - I've often wondered why mod functions always seem to do
this. Can anyone explain that? I can think of very few occasions when you
want to take the mod of a number and not restrict it to a single range,
rather than maintaining the positive or negative value. I understand that
doing it this way makes the function faster, but given that you usually have
to override it anyway that would seem a bit of a meaningless saving.

Danny

>
>

------------------------------------------------------------------------------

_______________________________________________
GDAlgorithms-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list