Python has math library and has many functions regarding to it.
math.remainder() method returns an exact (floating) value as a remainder.
For finite x and finite nonzero y, this is the difference x – n*y, where n is the closest integer to the exact value of the quotient x / y. If x / y is exactly halfway between two consecutive integers, the nearest even integer is used for n. The remainder
r = remainder(x, y) thus always satisfies abs(r) <= 0.5 * abs(y).
1.0 0.0 -2.0 0.0
math.isfinite() function –
math.isfinite() method returns True if x is neither an infinity nor a NaN, and False otherwise. (Note that 0.0 is considered finite.)
True False True True
Reference: Python Math Library
- Python math library | exp() method
- Python math library | isclose() method
- Python math library | isnan() method
- Python math library | expm1() method
- Python math library | gamma() function
- numpy.isfinite() in Python
- Python - math.prod() method
- Python - math.perm() method
- Python - math.comb() method
- Python - math.dist() method
- Python | math.isqrt() method
- numpy.remainder() in Python
- Python | Holidays library
- Python Pyforest Library
- Python Faker Library
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.