Frank van Maarseveen wrote:
> On Wed, Jul 22, 2009 at 08:21:29AM +0100, Martin Ling wrote:
>> On Wed, Jul 22, 2009 at 04:26:45AM +0000, Omari Stephens wrote:
>>>> 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.
>> Yes. ;-)
> 
> I've played with the idea too but it won't work. modulo 360 will yield
> -360..360 which is a range of 720 degrees, not 360. Modulo 180 yields
> the correct range but then the result is incorrect.

Yeah, the problem here is that fmod (and all "mod" operators/functions in 
anything C-like) actually implements the remainder operation and not the modulo 
operation.  Basically, that means that the output range of fmod(x, N) is [-N, 
N) 
rather than [0, N) with the modulo operator.

This is one reason I hate C, and every other language that figured it'd be good 
to be compatible with C :o)  (Note that I have no idea if Fortran behaves this 
way or not 8)

--xsdg

------------------------------------------------------------------------------
_______________________________________________
ufraw-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-devel

Reply via email to