From: Tim Peters <tim.one@ho...>  20010328 03:48:44

[Pilho Kim] > [Result on Python 2.0] > (2+1j)^55 = (1.55453313831e+019+5.99152971656e+018j) > > [Result on Jython 2.0 or Jython 2.1 alpha 1] > (2+1j)^55 = (9223372036854775807+5991529716557069312j) [Finn Bock] > I think I have tracked it down to PyComplex.toString(): > > public static String toString(double value) { > if (value == Math.floor(value)) { > return Long.toString((long)value); > } else { > return Double.toString(value); > } > } > > Changing that method to: > > public static String toString(double value) { > if (value == Math.floor(value) && > value < Long.MAX_VALUE && value > Long.MIN_VALUE) { > return Long.toString((long)value); > } else { > return Double.toString(value); > } > } > > seems to work for the test program, but my understanding of the finer > points of FP and complex numbers is zero. Take heart! Mine isn't, and I'm sure you've nailed it, except *perhaps* for wanting <= and >= instead of < and >. The original bare "value == Math.floor(value)" test is a common floatingpoint coding mistake, and across languages: the author always has in mind, for example, distinguishing 3.1 from "3.0 on the nose", but doesn't realize that, e.g., floor(1e300) == 1e300 too (every f.p. number with a "big enough" exponent is an exact integer!). nowondertheycallit"complex"<wink>ly y'rs  tim 