]> git.imager.perl.org - imager.git/commitdiff
- 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 8c26ad1e7b05898797139f994dbac6912c44b63a..24edb66b1dbe797a856f2bb725b833f7db04ce3b 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
 
           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:
 =================================================================
 
         For latest versions check the Imager-devel pages:
diff --git a/image.c b/image.c
index 4f7d93eb4a626f74bcd7e8548ac8c64338f02bbb..4fd56b4a83668026de9546f42061444996a6b505 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;
     hsize = (int)(0.5 + im->xsize * Value);
     if (hsize < 1) {
       hsize = 1;
-      Value = 1 / im->xsize;
+      Value = 1.0 / im->xsize;
     }
     vsize = im->ysize;
     
     }
     vsize = im->ysize;
     
@@ -920,7 +920,7 @@ i_scaleaxis(i_img *im, float Value, int Axis) {
 
     if (vsize < 1) {
       vsize = 1;
 
     if (vsize < 1) {
       vsize = 1;
-      Value = 1 / im->ysize;
+      Value = 1.0 / im->ysize;
     }
 
     jEnd = vsize;
     }
 
     jEnd = vsize;