]> granicus.if.org Git - imagemagick/commitdiff
https://imagemagick.org/discourse-server/viewtopic.php?f=26&t=36056
authorCristy <mikayla-grace@urban-warrior.org>
Sun, 19 May 2019 12:11:53 +0000 (08:11 -0400)
committerCristy <mikayla-grace@urban-warrior.org>
Sun, 19 May 2019 12:11:53 +0000 (08:11 -0400)
MagickCore/fx.c

index ee4c4086c39a8fcd15fc4f10618cce56567ba291..dedad147583c9fa1fa3d290b86c5a9335e3a6f96 100644 (file)
@@ -2192,25 +2192,13 @@ static double FxEvaluateSubexpression(FxInfo *fx_info,
         {
           *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth+1,beta,
             exception);
-          if (*beta == 0.0)
-            {
-              (void) ThrowMagickException(exception,GetMagickModule(),
-                OptionError,"DivideByZero","`%s'",expression);
-              FxReturn(0.0);
-            }
-          FxReturn(alpha/(*beta));
+          FxReturn(PerceptibleReciprocal(*beta)*alpha);
         }
         case '%':
         {
           *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth+1,beta,
             exception);
           *beta=fabs(floor((*beta)+0.5));
-          if (*beta == 0.0)
-            {
-              (void) ThrowMagickException(exception,GetMagickModule(),
-                OptionError,"DivideByZero","`%s'",expression);
-              FxReturn(0.0);
-            }
           FxReturn(fmod(alpha,*beta));
         }
         case '+':