hypot(3m) hypot(3m)
Name
hypot, cabs - Euclidean distance, complex absolute value
Syntax
#include <math.h>
double hypot(x,y)
double x,y;
float fhypot(float x, float y)
double cabs(z)
struct {double x,y;} z;
float fcabs(z)
struct {float x,y;} z;
Description
The and functions return the following:
sqrt(x*x+y*y)
This computation prevents underflows and overflows only if the final result dictates it.
The functions and are equivalent to the and function with the exception of float data type.
Error
When rounding off, for example, below 0.97 ulps. Consequently (5.0,12.0) = 13.0 exactly; in general, and return an integer whenever an
integer might be expected.
The same cannot be said for the shorter and faster version of and that is provided in the comments in cabs.c; its error can exceed 1.2
ulps.
Return Values
If the correct value overflows, and return HUGE_VAL. If x or y is NaN, then NaN is returned.
See Also
math(3m), sqrt(3m)
RISC hypot(3m)