diff --git a/magick/fx.c b/magick/fx.c
index 3eb1b6e..0ff9b41 100644
--- a/magick/fx.c
+++ b/magick/fx.c
@@ -64,6 +64,7 @@
 #include "magick/log.h"
 #include "magick/image.h"
 #include "magick/image-private.h"
+#include "magick/magick.h"
 #include "magick/memory_.h"
 #include "magick/monitor.h"
 #include "magick/monitor-private.h"
@@ -1494,7 +1495,7 @@
 
       (void) GetImageChannelKurtosis(image,channel,&kurtosis,&skewness,
         exception);
-      (void) FormatMagickString(statistic,MaxTextExtent,"%.15g",kurtosis);
+      (void) FormatMagickString(statistic,MaxTextExtent,"%g",kurtosis);
     }
   if (LocaleNCompare(symbol,"maxima",6) == 0)
     {
@@ -1503,7 +1504,7 @@
         minima;
 
       (void) GetImageChannelRange(image,channel,&minima,&maxima,exception);
-      (void) FormatMagickString(statistic,MaxTextExtent,"%.15g",maxima);
+      (void) FormatMagickString(statistic,MaxTextExtent,"%g",maxima);
     }
   if (LocaleNCompare(symbol,"mean",4) == 0)
     {
@@ -1513,7 +1514,7 @@
 
       (void) GetImageChannelMean(image,channel,&mean,&standard_deviation,
         exception);
-      (void) FormatMagickString(statistic,MaxTextExtent,"%.15g",mean);
+      (void) FormatMagickString(statistic,MaxTextExtent,"%g",mean);
     }
   if (LocaleNCompare(symbol,"minima",6) == 0)
     {
@@ -1522,7 +1523,7 @@
         minima;
 
       (void) GetImageChannelRange(image,channel,&minima,&maxima,exception);
-      (void) FormatMagickString(statistic,MaxTextExtent,"%.15g",minima);
+      (void) FormatMagickString(statistic,MaxTextExtent,"%g",minima);
     }
   if (LocaleNCompare(symbol,"skewness",8) == 0)
     {
@@ -1532,7 +1533,7 @@
 
       (void) GetImageChannelKurtosis(image,channel,&kurtosis,&skewness,
         exception);
-      (void) FormatMagickString(statistic,MaxTextExtent,"%.15g",skewness);
+      (void) FormatMagickString(statistic,MaxTextExtent,"%g",skewness);
     }
   if (LocaleNCompare(symbol,"standard_deviation",18) == 0)
     {
@@ -1542,7 +1543,7 @@
 
       (void) GetImageChannelMean(image,channel,&mean,&standard_deviation,
         exception);
-      (void) FormatMagickString(statistic,MaxTextExtent,"%.15g",
+      (void) FormatMagickString(statistic,MaxTextExtent,"%g",
         standard_deviation);
     }
   (void) AddValueToSplayTree(fx_info->symbols,ConstantString(key),
@@ -2543,7 +2544,7 @@
             }
           ClearMagickException(exception);
           *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,beta,exception);
-          (void) FormatMagickString(numeric,MaxTextExtent,"%.15g",(double)
+          (void) FormatMagickString(numeric,MaxTextExtent,"%g",(double)
             *beta);
           (void) DeleteNodeFromSplayTree(fx_info->symbols,subexpression);
           (void) AddValueToSplayTree(fx_info->symbols,ConstantString(
@@ -2704,8 +2705,9 @@
           if (strlen(subexpression) > 1)
             subexpression[strlen(subexpression)-1]='\0';
           if (fx_info->file != (FILE *) NULL)
-            (void) fprintf(fx_info->file,"%s[%ld,%ld].%s: %s=%.15g\n",
-              fx_info->images->filename,x,y,type,subexpression,(double) alpha);
+            (void) fprintf(fx_info->file,"%s[%ld,%ld].%s: %s=%*g\n",
+              fx_info->images->filename,x,y,type,subexpression,
+              GetMagickPrecision(),(double) alpha);
           return(0.0);
         }
       break;
@@ -4040,7 +4042,7 @@
           caption_image->background_color=image->border_color;
           (void) SetImageBackgroundColor(caption_image);
           (void) CloneString(&annotate_info->text,caption);
-          (void) FormatMagickString(geometry,MaxTextExtent,"+0+%.15g",
+          (void) FormatMagickString(geometry,MaxTextExtent,"+0+%g",
             metrics.ascent);
           if (annotate_info->gravity == UndefinedGravity)
             (void) CloneString(&annotate_info->geometry,AcquireString(
@@ -5692,7 +5694,7 @@
   (void) QueryColorDatabase("#ffffff",&draw_info->fill,exception);
   (void) QueryColorDatabase("#ffffff",&draw_info->stroke,exception);
   (void) FormatMagickString(ellipse,MaxTextExtent,
-    "ellipse %.15g,%.15g,%.15g,%.15g,0.0,360.0",image->columns/2.0,
+    "ellipse %g,%g,%g,%g,0.0,360.0",image->columns/2.0,
     image->rows/2.0,image->columns/2.0-x,image->rows/2.0-y);
   draw_info->primitive=AcquireString(ellipse);
   (void) DrawImage(oval_image,draw_info);