Re: Converting floats to a specific range

Richard Fabian <[email protected]> Fri, 7 May 2010 16:28:53 +0100
Newsgroups gmane.games.devel.algorithms
Message-ID <[email protected]>
I don't "know", but MOD is meant to be remainder on computers. It flummoxed
me as I came from a more mathematical background and MOD is defined as not
having negative numbers in the number field stuff

On 7 May 2010 13:35, Danny Kodicek <[email protected]> wrote:

>  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
>



-- 
fabs();
Just because the world is full of people that think just like you, doesn't
mean the other ones can't be right.

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

_______________________________________________
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