math.dim() function

The math.dim() function returns the maximum of x - y or 0.

Output data type: Float

import "math"

math.dim(x: 12.2, y: 8.1)

// Returns 4.1



The X value used in the operation.


The Y value used in the operation.

Special cases

math.dim(x: +Inf, y: +Inf) // Returns NaN
math.dim(x: -Inf, y: -Inf) // Returns NaN
math.dim(x:x, y    : NaN)  // Returns NaN
math.dim(x: NaN, y :y)     // 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.