Commit d6f595db authored by Boxiang Sun's avatar Boxiang Sun

add missing float attributes and tests

parent 5cfcc4e6
......@@ -747,7 +747,8 @@ float_rem(PyObject *v, PyObject *w)
return PyFloat_FromDouble(mod);
}
static PyObject *
// pyston change: make this not static
PyObject *
float_divmod(PyObject *v, PyObject *w)
{
double vx, wx;
......@@ -987,7 +988,8 @@ float_nonzero(PyFloatObject *v)
return v->ob_fval != 0.0;
}
static int
// pyston change: make not static
int
float_coerce(PyObject **pv, PyObject **pw)
{
if (PyInt_Check(*pw)) {
......@@ -1949,7 +1951,8 @@ PyDoc_STRVAR(float_getformat_doc,
"'unknown', 'IEEE, big-endian' or 'IEEE, little-endian' best describes the\n"
"format of floating point numbers used by the C type named by typestr.");
static PyObject *
// pyston change: make not static
PyObject *
float_setformat(PyTypeObject *v, PyObject* args)
{
char* typestr;
......
This diff is collapsed.
......@@ -111,3 +111,29 @@ print sys.float_info
if 1:
x = -2.0
print(float.__long__(sys.float_info.max))
print(float.__int__(sys.float_info.max))
data = ["-1.0", "0.0", "1.0",
"5.0", "-5.0",
"5", "5L", "0L", "5+5j",
"\"5\"", "None",
]
operations = ["__rpow__",
"__ridv__",
"__divmod__", "__rdivmod__",
"__rtruediv__",
"__coerce__"
]
for x in data:
for y in data:
for operation in operations:
try:
print(eval("float.{op}({arg1}, {arg2})".format(op=operation,
arg1=x,
arg2=y)))
except Exception as e:
print(e.message)
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