hypot(3M)


hypot -- Euclidean distance function

Synopsis

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

#include <math.h>

double hypot(double x, double y);

Description

hypot returns
   sqrt(x * x + y * y) 

taking precautions against unwarranted overflows.

Errors

When the correct value would overflow, hypot returns a value that will compare equal to +HUGE_VAL 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, +INFINITY 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)
30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.