[Jython-checkins] jython (2.5): #1840 fix nan<0 is True but should be False.
frank.wierzbicki
jython-checkins at python.org
Fri Mar 30 22:17:20 CEST 2012
http://hg.python.org/jython/rev/c514ff14cef5
changeset: 6510:c514ff14cef5
branch: 2.5
parent: 6508:581d909657b9
user: Frank Wierzbicki <fwierzbicki at gmail.com>
date: Fri Mar 30 12:52:55 2012 -0700
summary:
#1840 fix nan<0 is True but should be False.
files:
src/org/python/core/PyFloat.java | 36 ++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/src/org/python/core/PyFloat.java b/src/org/python/core/PyFloat.java
--- a/src/org/python/core/PyFloat.java
+++ b/src/org/python/core/PyFloat.java
@@ -196,6 +196,42 @@
}
@Override
+ public PyObject __gt__(PyObject other) {
+ // NaN > anything is always false.
+ if (Double.isNaN(getValue())) {
+ return Py.False;
+ }
+ return null;
+ }
+
+ @Override
+ public PyObject __ge__(PyObject other) {
+ //NaN >= anything is always false.
+ if (Double.isNaN(getValue())) {
+ return Py.False;
+ }
+ return null;
+ }
+
+ @Override
+ public PyObject __lt__(PyObject other) {
+ //NaN < anything is always false.
+ if (Double.isNaN(getValue())) {
+ return Py.False;
+ }
+ return null;
+ }
+
+ @Override
+ public PyObject __le__(PyObject other) {
+ //NaN >= anything is always false.
+ if (Double.isNaN(getValue())) {
+ return Py.False;
+ }
+ return null;
+ }
+
+ @Override
public int __cmp__(PyObject other) {
return float___cmp__(other);
}
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list