Logo

Programming-Idioms

History of Idiom 200 > diff from v10 to v11

Edit summary for version 11 by mobombo:
New Rust implementation by user [mobombo]

Version 10

2019-10-17, 21:07:21

Version 11

2020-01-08, 17:26:37

Idiom #200 Return hypotenuse

Returns the hypotenuse h of the triangle where the sides adjacent to the square angle have lengths x and y.

Idiom #200 Return hypotenuse

Returns the hypotenuse h of the triangle where the sides adjacent to the square angle have lengths x and y.

Extra Keywords
pythagore square geometry trigo trigonometry
Extra Keywords
pythagore square geometry trigo trigonometry
Code
fn hypot(x:f64, y:f64)-> f64 {
    let num = x.powi(2) + y.powi(2);
    num.powf(0.5)
}