MacArthur, Ian (SELEX) (UK) wrote:
> The FL/math.h includes this implementation of copysign:
>
> inline double copysign(double a, double b) {return b<0 ? -a : a;}
>
>
> That looks wrong to me. I think we should only invert the sign of "a" if
> it is different from the sign of "b". For example, with the current
> code, if we pass a == -2 and b == -5 then we will return +2, which is
> surely wrong?
>
> Maybe something like this is better:
>
> inline double copysign(double a, double b) {return b<0 ? (a<0 ? a :
> -a) : (a<0 ? -a : a);}
>
> This may all be moot anyway, since the fltk code doesn't seem to use
> copysign anywhere, but I worry that it might break some code that uses
> fltk.
>
> I'd vote for removing this definition from our math.h entirely, if we do
> indeed not use it, and let the end user resolve this themselves, if they
> need it for portability reasons.
+1, let's remove it.
--
______________________________________________________________________
Michael Sweet, Easy Software Products mike at easysw dot com
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev