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) float64

Parameters & Attributes

NameTypeDescription
pfloat64First input component.
qfloat64Second 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))}
Go Reference