Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fmin(3C) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                 fmin(3C)



        _________________________________________________________________
        fmin                                            $builtin function
        Determine the minimum value of twofloating-point numbers.
        _________________________________________________________________


        Calling Sequence

        double a, b, c, fmin();
        a = fmin(b, c);

        (or)

        $builtin double fmin();
        double a, b, c;
        a = fmin(b, c);

        where a, b, and c are of type double.


        Description

        Use the fmin function to find the minimum value of two floating-
        point numbers.

        The first version noted 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 function and uses the
        $builtin version.  Using the include file will not cause any
        portability problems.


        Returns

        The fmin function returns the minimum of the two floating-point
        numbers you pass to it.


        Related Functions

        See also the ceil, floor, fmax, max, and min functions.


        Example

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

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



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





                                                                 fmin(3C)



        int     i = 1;
        double m, n, o, atof(), fmin();

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

        A call to the program test with the input numbers

        6.78e-5
        .0001
        -3.1416
        .0098e3

        generates the output

        fmin of 0.000068 and 0.000100 = 0.000068
        fmin of 0.000100 and -3.141600 = -3.141600
        fmin of -3.141600 and 9.800000 = -3.141600



























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



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