Standard library / math
math.Hypot()
Euclidean magnitude sqrt(p*p+q*q) with improved scaling against overflow and underflow. Expected stdout: '5\n'.
Formal Syntax & Structure
go syntaxgo
func Hypot(p, q float64) float64Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| p | float64 | First input component. |
| q | float64 | Second input component. |
Return Value
float64
Euclidean magnitude sqrt(p*p+q*q) with improved scaling against overflow and underflow.
Working Example
Example Snippetgo
package main
import ( "fmt" "math")
func main() { fmt.Println(math.Hypot(3, 4))}