hypot(3M)


hypot -- Euclidean distance function

Synopsis

   cc [flag ...] file ...  -lm [library ...]
   

#include <math.h>

double hypot(double x, double y);

float hypotf(float x, float y);

long double hypotl(long double x, long double y);

Description

hypot, hypotf and hypotl return
   sqrt(x * x + y * y)

taking precautions against unwarranted overflows.

Errors

When the correct value would overflow, hypot, hypotf and hypotl return a value that compares equal to +HUGE_VAL, +HUGE_VALF or +HUGE_VALL (respectively) and sets errno to ERANGE.

On systems that support IEEE NaN, if either argument is a quiet NaN, that value is returned. If either argument is a signaling NaN, a quiet NaN is returned and the invalid operation exception is raised. In either case, errno is set to EDOM. The only exception is that if one argument is a NaN and the other argument is ±INFINITY, +HUGE_VAL is returned with no error indication.

If the program was compiled with the -Xt compilation mode, a value that will compare equal to HUGE is returned instead of HUGE_VAL. These error handling procedures may be changed with the function matherr.

References

cc(1), matherr(3M)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004