math.hypot() function

Warning! This page documents an earlier version of Flux, which is no longer actively developed. Flux v0.36 is the most recent stable version of Flux.

The math.hypot() function returns the square root of p*p + q*q, taking care to avoid overflow and underflow.

Output data type: Float

import "math"

math.hypot(p: 2.0, q: 5.0)

// Returns 5.385164807134505

Parameters

p

The p value used in the operation.

Data type: Float

q

The q value used in the operation.

Data type: Float

Special cases

math.hypot(p: ±Inf, q:q) // Returns +Inf
math.hypot(p:p, q: ±Inf) // Returns +Inf
math.hypot(p: NaN, q:q)  // Returns NaN
math.hypot(p:p, q: NaN)  // Returns NaN