Commit f5177494 authored by Guido van Rossum's avatar Guido van Rossum

Added nonzero test

parent 112b4cd1
...@@ -260,6 +260,13 @@ float_abs(v) ...@@ -260,6 +260,13 @@ float_abs(v)
return float_pos(v); return float_pos(v);
} }
static int
float_nonzero(v)
floatobject *v;
{
return v->ob_fval != 0.0;
}
static number_methods float_as_number = { static number_methods float_as_number = {
float_add, /*nb_add*/ float_add, /*nb_add*/
float_sub, /*nb_subtract*/ float_sub, /*nb_subtract*/
...@@ -271,6 +278,7 @@ static number_methods float_as_number = { ...@@ -271,6 +278,7 @@ static number_methods float_as_number = {
float_neg, /*nb_negative*/ float_neg, /*nb_negative*/
float_pos, /*nb_positive*/ float_pos, /*nb_positive*/
float_abs, /*nb_absolute*/ float_abs, /*nb_absolute*/
float_nonzero, /*nb_nonzero*/
}; };
typeobject Floattype = { typeobject Floattype = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment