Macaulay2 » Documentation
Packages » Python » PythonObject » remainder(PythonObject,PythonObject)
next | previous | forward | backward | up | index | toc

remainder(PythonObject,PythonObject) -- remainder of python objects

Description

This calls Python's built-in math.remainder function, which computes the IEEE 754-style remainder of x with respect to y. In particular, this is $x - qy$, where q is the integer closed to $\frac{x}{y}$, breaking ties by rounding $\frac{1}{2}$ to the nearest even integer.

i1 : remainder(toPython 7, toPython 2)

o1 = -1.0

o1 : PythonObject of class float
i2 : remainder(toPython 9, toPython 2)

o2 = 1.0

o2 : PythonObject of class float

If one of the arguments is a Macaulay2 object, then it is first converted to a Python object before computing the remainder.

i3 : remainder(toPython 7, 2)

o3 = -1.0

o3 : PythonObject of class float
i4 : remainder(9, toPython 9)

o4 = 0.0

o4 : PythonObject of class float

Ways to use this method:


The source of this document is in Python/doc/floating-point.m2:82:0.