Use ~10x faster sqrt instead of pow when y=0.5

This commit is contained in:
Lovell Fuller 2017-11-17 20:24:28 +00:00
parent ef9b23b95a
commit bb58685d1c

View File

@ -139,7 +139,9 @@ vips_math2_build( VipsObject *object )
\
/* Division by zero! Difficult to report tho' \
*/ \
(Y) = (left == 0.0 && right < 0.0) ? 0.0 : pow( left, right ); \
(Y) = (right == 0.5) \
? sqrt( left ) \
: (left == 0.0 && right < 0.0) ? 0.0 : pow( left, right ); \
}
#define WOP( Y, X, E ) POW( Y, E, X )