From: <fwi...@us...> - 2009-01-15 03:36:13
|
Revision: 5934 http://jython.svn.sourceforge.net/jython/?rev=5934&view=rev Author: fwierzbicki Date: 2009-01-15 03:36:09 +0000 (Thu, 15 Jan 2009) Log Message: ----------- Change negate so that -0 and -0.0 behave as CPython behaves (no USub node, just negate zero). Modified Paths: -------------- trunk/jython/src/org/python/antlr/GrammarActions.java Modified: trunk/jython/src/org/python/antlr/GrammarActions.java =================================================================== --- trunk/jython/src/org/python/antlr/GrammarActions.java 2009-01-15 03:14:36 UTC (rev 5933) +++ trunk/jython/src/org/python/antlr/GrammarActions.java 2009-01-15 03:36:09 UTC (rev 5934) @@ -483,7 +483,7 @@ Num num = (Num)o; if (num.getInternalN() instanceof PyInteger) { int v = ((PyInteger)num.getInternalN()).getValue(); - if (v > 0) { + if (v >= 0) { num.setN(new PyInteger(-v)); return num; } @@ -495,13 +495,13 @@ } } else if (num.getInternalN() instanceof PyFloat) { double v = ((PyFloat)num.getInternalN()).getValue(); - if (v > 0) { + if (v >= 0) { num.setN(new PyFloat(-v)); return num; } } else if (num.getInternalN() instanceof PyComplex) { double v = ((PyComplex)num.getInternalN()).imag; - if (v > 0) { + if (v >= 0) { num.setN(new PyComplex(0,-v)); return num; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |