math_ceil(PyObject *module, PyObject *number)
/*[clinic end generated code: output=6c3b8a78bc201c67 input=2725352806399cab]*/
{
+ double x;
- if (!PyFloat_CheckExact(number)) {
+ if (PyFloat_CheckExact(number)) {
+ x = PyFloat_AS_DOUBLE(number);
+ }
+ else {
math_module_state *state = get_math_module_state(module);
PyObject *method = _PyObject_LookupSpecial(number, state->str___ceil__);
if (method != NULL) {
}
if (PyErr_Occurred())
return NULL;
+ x = PyFloat_AsDouble(number);
+ if (x == -1.0 && PyErr_Occurred())
+ return NULL;
}
- double x = PyFloat_AsDouble(number);
- if (x == -1.0 && PyErr_Occurred())
- return NULL;
-
return PyLong_FromDouble(ceil(x));
}
if (PyFloat_CheckExact(number)) {
x = PyFloat_AS_DOUBLE(number);
}
- else
- {
+ else {
math_module_state *state = get_math_module_state(module);
PyObject *method = _PyObject_LookupSpecial(number, state->str___floor__);
if (method != NULL) {