special case for **-1
Since it's very common. See https://github.com/libvips/libvips/discussions/2352
This commit is contained in:
parent
b493b16e54
commit
dd4b11063a
@ -137,11 +137,16 @@ vips_math2_build( VipsObject *object )
|
|||||||
double left = (double) (X); \
|
double left = (double) (X); \
|
||||||
double right = (double) (E); \
|
double right = (double) (E); \
|
||||||
\
|
\
|
||||||
/* Division by zero! Difficult to report tho' \
|
/* Special case for **-1 and **0.5, since they are so common. Also \
|
||||||
|
* watch for /0. \
|
||||||
*/ \
|
*/ \
|
||||||
(Y) = (right == 0.5) \
|
(Y) = (left == 0.0) \
|
||||||
|
? 0.0 \
|
||||||
|
: (right == -1) \
|
||||||
|
? 1.0 / left \
|
||||||
|
: (right == 0.5) \
|
||||||
? sqrt( left ) \
|
? sqrt( left ) \
|
||||||
: (left == 0.0 && right < 0.0) ? 0.0 : pow( left, right ); \
|
: pow( left, right ); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WOP( Y, X, E ) POW( Y, E, X )
|
#define WOP( Y, X, E ) POW( Y, E, X )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user