Skip to content

Commit 40db4db

Browse files
committed
use PyFloat_AS_DOUBLE for getting direct value without checking
1 parent e1ac18c commit 40db4db

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
Implementation of missing floor and ceil methods to float object -- by
2-
Batuhan Taskaya.
1+
Added ``__floor__`` and ``__ceil__`` methods to float object. Patch by Batuhan Taşkaya.

Objects/floatobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ static PyObject *
933933
float___floor___impl(PyObject *self)
934934
/*[clinic end generated code: output=e0551dbaea8c01d1 input=77bb13eb12e268df]*/
935935
{
936-
double x = PyFloat_AsDouble(self);
936+
double x = PyFloat_AS_DOUBLE(self);
937937
return PyLong_FromDouble(floor(x));
938938
}
939939

@@ -947,7 +947,7 @@ static PyObject *
947947
float___ceil___impl(PyObject *self)
948948
/*[clinic end generated code: output=a2fd8858f73736f9 input=79e41ae94aa0a516]*/
949949
{
950-
double x = PyFloat_AsDouble(self);
950+
double x = PyFloat_AS_DOUBLE(self);
951951
return PyLong_FromDouble(ceil(x));
952952
}
953953

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy