File ImageMagick-0-1-are-special-cases-for-pow.patch of Package ImageMagick.38922

Index: ImageMagick-7.1.1-21/MagickCore/statistic.c
===================================================================
--- ImageMagick-7.1.1-21.orig/MagickCore/statistic.c
+++ ImageMagick-7.1.1-21/MagickCore/statistic.c
@@ -377,7 +377,7 @@ static double ApplyEvaluateOperator(Rand
     }
     case PowEvaluateOperator:
     {
-      if (PerceptibleReciprocal(value) <= MagickEpsilon)
+      if (fabs(value) <= MagickEpsilon)
         break;
       if (((double) pixel < 0.0) && ((value-floor(value)) > MagickEpsilon))
         result=(double) -((double) QuantumRange*pow(-(QuantumScale*(double)
Index: ImageMagick-7.1.1-21/MagickWand/operation.c
===================================================================
--- ImageMagick-7.1.1-21.orig/MagickWand/operation.c
+++ ImageMagick-7.1.1-21/MagickWand/operation.c
@@ -2475,14 +2475,15 @@ static MagickBooleanType CLISimpleOperat
           if (IsGeometry(arg1) == MagickFalse)
             CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
           constant=StringToDouble(arg1,(char **) NULL);
-#if 1
+#if 0
           /* Using Gamma, via a cache */
           if (IfPlusOp)
             constant=PerceptibleReciprocal(constant);
           (void) GammaImage(_image,constant,_exception);
 #else
           /* Using Evaluate POW, direct update of values - more accurate */
-          if (IfNormalOp)
+          if (IfNormalOp && (fabs(constant) <= MagickEpsilon) &&
+             ((constant-1.0) > MagickEpsilon))
             constant=PerceptibleReciprocal(constant);
           (void) EvaluateImage(_image,PowEvaluateOperator,constant,_exception);
           _image->gamma*=StringToDouble(arg1,(char **) NULL);
openSUSE Build Service is sponsored by