RE: [AD] Small bugfix in hsv_to_rgb() and smaller fix in rgb_to_hsv()

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


>> I had another look at the code, and noticed that in the hsv_to_rgb()
>> function, the error does not lead to much so you could get away with
>> '==0.0f' for hsv_to_rgb(). However, when I was working on my own
>> rgb_to_hls() function, this error lead to out-of-range values
>when doing a
>> divide so I used it there and thought I might port it to
>hsv_to_rgb(), but
>> now that does seem to be a bit overkill. If you decide to get rid of the
>> '< FLT_EPSILON's, then also make sure you remove the #include <float.h>
>
>Yes, there is no division in the function so we don't need to be
>excessively
>careful. And loading a floating-point constant is not cheap. Therefore I
>think we'd better not change anything.

I agree about the floats, but the code for making sure the cast from float
to int truncates instead of rounds should be changed, and also, the patch
tidies up a few things, like remembering to put an 'f' at the end of
float-constants and adding some casts that weren't there before.


AE.





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/