- the changes to scale() had some problems with integer vs floating point
authorTony Cook <tony@develop=help.com>
Mon, 18 Oct 2004 04:03:35 +0000 (04:03 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 18 Oct 2004 04:03:35 +0000 (04:03 +0000)
  calculations (only caught in tests under perl 5.8.5 <sigh>)

Changes
image.c

diff --git a/Changes b/Changes
index 8c26ad1..24edb66 100644 (file)
--- a/Changes
+++ b/Changes
@@ -844,6 +844,11 @@ Revision history for Perl extension Imager.
           Resolves https://rt.cpan.org/Ticket/Display.html?id=7581
         - built 0.43_01 for testing
 
+0.43_02
+
+- the changes to scale() had some problems with integer vs floating point
+  calculations (only caught in tests under perl 5.8.5 <sigh>)
+
 =================================================================
 
         For latest versions check the Imager-devel pages:
diff --git a/image.c b/image.c
index 4f7d93e..4fd56b4 100644 (file)
--- a/image.c
+++ b/image.c
@@ -908,7 +908,7 @@ i_scaleaxis(i_img *im, float Value, int Axis) {
     hsize = (int)(0.5 + im->xsize * Value);
     if (hsize < 1) {
       hsize = 1;
-      Value = 1 / im->xsize;
+      Value = 1.0 / im->xsize;
     }
     vsize = im->ysize;
     
@@ -920,7 +920,7 @@ i_scaleaxis(i_img *im, float Value, int Axis) {
 
     if (vsize < 1) {
       vsize = 1;
-      Value = 1 / im->ysize;
+      Value = 1.0 / im->ysize;
     }
 
     jEnd = vsize;