Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cc(1)

reentrant(3)

matherr(3M)

fpsetmask(3C)



hypot(3M)                      DG/UX R4.11MU05                     hypot(3M)


NAME
       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.


   Considerations for Threads Programming
                     +---------+-----------------------------+
                     |         |                      async- |
                     |function | reentrant   cancel   cancel |
                     |         |             point     safe  |
                     +---------+-----------------------------+
                     |hypot    |     Y         N        N    |
                     +---------+-----------------------------+

EXAMPLE
       /* Program test for the hypot() function */

       #include <stdio.h>
       #include <math.h>

       double  atof(), x, y, z, hypot();

       main(argc, argv)
       int     argc;
       char    *argv[];
       {
           x = atof(argv[1]);
           y = atof(argv[2]);
           printf("Hypotenuse = %f.\n", z = hypot(x, y));
       }

       A call to the program test with the numbers 3.3 and 4.4

       Hypotenuse = 5.500000.

DIAGNOSTICS
       When the correct value would overflow, hypot returns HUGE and sets
       errno to ERANGE.

       If either argument is a quiet NaN, that value is returned.  If either
       argument is a signaling NaN, a quiet NaN is returned and an invalid
       operation exception is raised.  In either case, errno is set to EDOM,
       and a message indicating DOMAIN error is printed on the standard
       error output.  The one exception is that if one argument is a NaN and
       the other argument is ±oo, then +oo is returned with no error
       indication.

       When the -Xt compilation option is used, these error-handling
       procedures may be changed with the function matherr.

       When the -Xa or -Xc compilation options are used, HUGE_VAL is
       returned instead of HUGE, and no error messages are printed.

SEE ALSO
       cc(1), reentrant(3), matherr(3M), fpsetmask(3C).


Licensed material--property of copyright holder(s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026