Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pow(3C) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                  pow(3C)



        _________________________________________________________________
        pow                                             $builtin function
        Raise the first argument to the power of the second argument.
        _________________________________________________________________


        Calling Sequence

        double m, n, o, pow();
        m = pow(n,o);

        (or)

        $builtin double pow();
        double m, n, o;
        m = pow(n,o);

        where m, n, and o are of type double.


        Description

        Use the pow function to return the value of one argument raised
        to the power of another.  With pow, m is the result of raising n
        to the power o.

        The first version of the calling sequence above uses a function
        call.  The second might generate smaller or faster code, but may
        not run under other C compilers.

        The include file math.h defines this entry and uses the $builtin
        version.


        Returns

        If floating-point overflow or underflow occurs, this function
        returns the largest possible floating-point number and sets errno
        to ERANGE (defined in errno.h).


        Related Functions

        See also the exp function.


        Example

        /* Program test for the pow() function */

        #include <math.h>



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                  pow(3C)



        int     i = 2;
        double  m, n, o, atof(), pow();

        main(argc, argv)
        int    argc;
        char  *argv[];
        {
            n = atof(argv[1]);
            while (i < argc) {
                o = atof(argv[i]);
                printf("%f\tto the power %f = %f\n", n, o,
                m = pow(n, o));
                i++;
            }
        }

        A call to the program test with the number 1.999999 followed by
        the numbers 10, 5, 2.5, 1.25, and 0.625 generates the output

        1.999999 to the power 10.000000 = 1023.994880
        1.999999 to the power 5.000000 = 31.999920
        1.999999 to the power 2.500000 = 5.656847
        1.999999 to the power 1.250000 = 2.378413
        1.999999 to the power 0.625000 = 1.542210






























        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)



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