// Copyright 2010 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package math/* Hypot -- sqrt(p*p + q*q), but overflows only if the result does.*/// Hypot returns Sqrt(p*p + q*q), taking care to avoid// unnecessary overflow and underflow.//// Special cases are://// Hypot(±Inf, q) = +Inf// Hypot(p, ±Inf) = +Inf// Hypot(NaN, q) = NaN// Hypot(p, NaN) = NaNfunc (, float64) float64 {ifhaveArchHypot {returnarchHypot(, ) }returnhypot(, )}func (, float64) float64 { , = Abs(), Abs()// special casesswitch {caseIsInf(, 1) || IsInf(, 1):returnInf(1)caseIsNaN() || IsNaN():returnNaN() }if < { , = , }if == 0 {return0 } = / return * Sqrt(1+*)}
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.