Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
use PyFloat_AS_DOUBLE for getting direct value without checking
  • Loading branch information
isidentical committed Dec 3, 2019
commit 40db4db4ef5fa6d2e775d8d3846327f56c89b13b
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Implementation of missing floor and ceil methods to float object -- by
Batuhan Taskaya.
Added ``__floor__`` and ``__ceil__`` methods to float object. Patch by Batuhan Taşkaya.
4 changes: 2 additions & 2 deletions Objects/floatobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ static PyObject *
float___floor___impl(PyObject *self)
/*[clinic end generated code: output=e0551dbaea8c01d1 input=77bb13eb12e268df]*/
{
double x = PyFloat_AsDouble(self);
double x = PyFloat_AS_DOUBLE(self);
return PyLong_FromDouble(floor(x));
}

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

Expand Down