Chapter Contents

Previous

Next
hypot

hypot



Compute the Hypotenuse function

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
DIAGNOSTICS
PORTABILITY
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <lcmath.h>

double hypot(double x,double y);


DESCRIPTION

hypot computes the square root of the sum of squares of its two arguments. The value returned by hypot is defined by this equation:

[IMAGE]


RETURN VALUE

hypot returns the square root of the sum of the squares of its arguments.


DIAGNOSTICS

The run-time library writes an error message to the standard error file ( stderr ) if the result of the computation would be larger than HUGE_VAL . In this case, the function returns HUGE_VAL , the largest positive floating-point number that can be represented.

If an error occurs in hypot , the _matherr routine is called. You can supply your own version of _matherr to suppress the diagnostic message or modify the value returned.


PORTABILITY

hypot is portable to many, but not all, non UNIX C implementations.


EXAMPLE

#include <stdio.h>
#include <lcmath.h>

#define SVECTOR .7854

main()
{
   double hypov;
   hypov = hypot(SVECTOR,-SVECTOR);
   printf("hypot(%f,%f) = %f \n", SVECTOR,-SVECTOR, hypov);
}


RELATED FUNCTIONS

_matherr


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.