summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-05-14 11:57:01 (GMT)
committerGuido van Rossum <guido@python.org>1991-05-14 11:57:01 (GMT)
commit50b4ef64eb745902ac9c88427646b8005d4b97e9 (patch)
tree6cf1004c454028e11198176b1b6db53e745371f4 /Objects
parentfb8edfce22dccfb0014f4f43b1735d7e42e80c45 (diff)
downloadcpython-50b4ef64eb745902ac9c88427646b8005d4b97e9.zip
cpython-50b4ef64eb745902ac9c88427646b8005d4b97e9.tar.gz
cpython-50b4ef64eb745902ac9c88427646b8005d4b97e9.tar.bz2
Added nonzero test
Diffstat (limited to 'Objects')
-rw-r--r--Objects/floatobject.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 5249db7..0549990 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -260,6 +260,13 @@ float_abs(v)
return float_pos(v);
}
+static int
+float_nonzero(v)
+ floatobject *v;
+{
+ return v->ob_fval != 0.0;
+}
+
static number_methods float_as_number = {
float_add, /*nb_add*/
float_sub, /*nb_subtract*/
@@ -271,6 +278,7 @@ static number_methods float_as_number = {
float_neg, /*nb_negative*/
float_pos, /*nb_positive*/
float_abs, /*nb_absolute*/
+ float_nonzero, /*nb_nonzero*/
};
typeobject Floattype = {