File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1154,6 +1154,12 @@ extern "C" {
1154
1154
#[ wasm_bindgen( static_method_of = Math ) ]
1155
1155
pub fn fround ( x : f64 ) -> f32 ;
1156
1156
1157
+ /// The Math.hypot() function returns the square root of the sum of squares of its arguments.
1158
+ ///
1159
+ /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround
1160
+ #[ wasm_bindgen( static_method_of = Math ) ]
1161
+ pub fn hypot ( x : f64 , y : f64 ) -> f64 ;
1162
+
1157
1163
/// The Math.imul() function returns the result of the C-like 32-bit multiplication of the
1158
1164
/// two parameters.
1159
1165
///
Original file line number Diff line number Diff line change @@ -128,6 +128,14 @@ fn fround() {
128
128
assert ! ( Math :: fround( -5.05 ) == -5.050000190734863 ) ;
129
129
}
130
130
131
+ #[ wasm_bindgen_test]
132
+ fn hypot ( ) {
133
+ assert ! ( Math :: hypot( 3. , 4. ) == 5. ) ;
134
+ assert ! ( Math :: hypot( 3.9 , 5.2 ) == 6.5 ) ;
135
+ assert ! ( Math :: hypot( 6. , 8. ) == 10. ) ;
136
+ assert ! ( Math :: hypot( 7. , 24. ) == 25. ) ;
137
+ }
138
+
131
139
#[ wasm_bindgen_test]
132
140
fn imul ( ) {
133
141
assert ! ( Math :: imul( 3 , 4 ) == 12 ) ;
You can’t perform that action at this time.
0 commit comments