math.mod() function

The math.mod() function returns the floating-point remainder of x/y. The magnitude of the result is less than y and its sign agrees with that of x.

Output data type: Float

import "math"

math.mod(x: 1.23, y: 4.56)

// Returns 1.23



The X value used in the operation.


The Y value used in the operation.

Special cases

math.mod(x: ±Inf, y:y)  // Returns NaN
math.mod(x: NaN, y:y)   // Returns NaN
math.mod(x:x, y: 0)     // Returns NaN
math.mod(x:x, y: ±Inf)  // Returns x
math.mod(x:x, y: NaN)   // Returns NaN

Was this page helpful?

Thank you for your feedback!

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.