content/flux/v0/stdlib/math/hypot.md
math.hypot() returns the square root of p*p + q*q, taking care to avoid overflow
and underflow.
(p: float, q: float) => float
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
({{< req >}}) p-value to use in the operation.
({{< req >}}) q-value to use in the operation.
import "math"
math.hypot(p: 2.0, q: 5.0)// 5.385164807134505
import "math"
data
|> map(fn: (r) => ({r with _value: math.hypot(p: r.a, q: r.b)}))
{{< expand-wrapper >}} {{% expand "View example input and output" %}}
| triangle | a | b |
|---|---|---|
| t1 | 12.3 | 11.7 |
| t2 | 109.6 | 23.3 |
| t3 | 8.2 | 34.2 |
| t4 | 33.9 | 28 |
| t5 | 25 | 25 |
| _value | a | b | triangle |
|---|---|---|---|
| 16.975865220954127 | 12.3 | 11.7 | t1 |
| 112.04931949815669 | 109.6 | 23.3 | t2 |
| 35.16930479836074 | 8.2 | 34.2 | t3 |
| 43.9682840238279 | 33.9 | 28 | t4 |
| 35.35533905932738 | 25 | 25 | t5 |
{{% /expand %}} {{< /expand-wrapper >}}