Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ modf(3C) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                 modf(3C)



        _________________________________________________________________
        modf                                                     function
        Return the fractional part of a number and store theinteger
        portion.
        _________________________________________________________________


        Calling Sequence

        #include <math.h>

        double modf(), frac, value, *mant;
        frac = modf(value, mant);


        Description

        The modf function takes the value you specify, returns its
        fractional portion (frac), and stores its integer portion in the
        location that mant points to.

        The include file math.h defines this function.


        Returns

        The modf function returns the fractional portion of the value.


        Related Functions

        See also the fmod function.


        Example

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

        #include <math.h>

        double  value, mant, atof(), modf();
        int     i = 1;

        main(argc, argv)
        int    argc;
        char  *argv[];
        {
            while (i < argc) {
                value = atof(argv[i]);
                printf("Result on %f = %f\n", value,
                        modf(value, &mant));



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





                                                                 modf(3C)



                i++;
            }
        }

        A call to the program test with the numbers 3.1416, 2.718,
        0.0001, and 4e-4 generates the output

        Result on 3.141600 = 0.141600
        Result on 2.718000 = 0.718000
        Result on 0.000100 = 0.000100
        Result on 0.000400 = 0.000400











































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



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