Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ hypot(3M) — DG/UX 5.4.2A

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

matherr(3M)



hypot(3M)                        DG/UX 5.4.2                       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.

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.

SEE ALSO
       matherr(3M).

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

       Except when the -Xc compilation option is used, these error-handling
       procedures may be changed with the function matherr.  When the -Xa or
       -Xc compilation options are used, HUGEVAL is returned instead of
       HUGE.








Licensed material--property of copyright holder(s)                         1


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