On this page
  1. math.fmod
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

math.fmod

Prev: math.fma | Up: math | Next: math.frexp
Rel: math.acos, math.acosh, math.asin, math.asinh
Ref: docs.python.org — math.fmod
Tags: #public #python3 #stdlib #math


Import

import math
from math import fmod

Signature & Overview

math.fmod(x, y, /)

Return fmod(x, y), according to platform C.

Usage

import math

assert math.fmod(-7.0, 3.0) == -1.0   # sign follows dividend (-7.0)
assert (-7.0 % 3.0) == 2.0            # Python's % follows divisor (3.0)

Gotchas

REPL Inspect

from math import fmod
help(fmod)

Linked from

Related notes