[Image-SIG] Bug in convert?

Edward C. Jones edcjones@erols.com
Sat, 21 Dec 2002 19:45:52 -0500


The following program gives the unexpected answer of -2147483648. The 
source code for "f2i" in "Convert.c" simply casts the float to an int. 
My copy of Harbison & Steele says that the cast is undefined in this case.

I use Gentoo 1.3 on a PC.

"gcc -v" gives:
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs
gcc version 2.95.3 20010315 (release)
--------------------------
#! /usr/bin/env python

import Image

im = Image.new("F", (1,1), 1.0e11)
print im.convert("I").getpixel( (0,0) )