Source File
hypot.go
Belonging Package
math
// 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 {if haveArchHypot {return archHypot(, )}return hypot(, )}func (, float64) float64 {, = Abs(), Abs()// special casesswitch {case IsInf(, 1) || IsInf(, 1):return Inf(1)case IsNaN() || IsNaN():return NaN()}if < {, = ,}if == 0 {return 0}= /return * Sqrt(1+*)}
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64)