@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___floordiv___doc) final PyObject long___floordiv__(PyObject right) { if (!canCoerce(right)) { return null; } return Py.newLong(divide(getValue(), coerce(right))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rfloordiv___doc) final PyObject long___rfloordiv__(PyObject left) { if (!canCoerce(left)) { return null; } return Py.newLong(divide(coerce(left), getValue())); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___div___doc) final PyObject long___div__(PyObject right) { if (!canCoerce(right)) { return null; } if (Options.division_warning > 0) { Py.warning(Py.DeprecationWarning, "classic long division"); } return Py.newLong(divide(getValue(), coerce(right))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rdiv___doc) final PyObject long___rdiv__(PyObject left) { if (!canCoerce(left)) { return null; } if (Options.division_warning > 0) { Py.warning(Py.DeprecationWarning, "classic long division"); } return Py.newLong(divide(coerce(left), getValue())); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___mod___doc) final PyObject long___mod__(PyObject right) { if (!canCoerce(right)) { return null; } BigInteger rightv = coerce(right); return Py.newLong(modulo(getValue(), rightv, divide(getValue(), rightv))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rmod___doc) final PyObject long___rmod__(PyObject left) { if (!canCoerce(left)) { return null; } BigInteger leftv = coerce(left); return Py.newLong(modulo(leftv, getValue(), divide(leftv, getValue()))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rdivmod___doc) final PyObject long___rdivmod__(PyObject left) { if (!canCoerce(left)) { return null; } BigInteger leftv = coerce(left); BigInteger xdivy = divide(leftv, getValue()); return new PyTuple(Py.newLong(xdivy), Py.newLong(modulo(leftv, getValue(), xdivy))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___divmod___doc) final PyObject long___divmod__(PyObject right) { if (!canCoerce(right)) { return null; } BigInteger rightv = coerce(right); BigInteger xdivy = divide(getValue(), rightv); return new PyTuple(Py.newLong(xdivy), Py.newLong(modulo(getValue(), rightv, xdivy))); }