SUMMARY: single prec functions in C

mau at alice.CSELT.STET.IT mau at alice.CSELT.STET.IT
Thu Jan 24 19:23:11 AEST 1991


A lot of time ago (our Internet gateway in this period is not very good) I
posted a message about calling single precision math routines in a C
program.  Indeed, I read the wrong manual: my fault was in the call of the
function..  A correct algorithm is shown below:

----- begin of program -----

#include <stdio.h>
#include <math.h>
FLOATFUNCTIONTYPE r_exp_();

main()
{
        float * y;
        double x;
        FLOATFUNCTIONTYPE x1;

        y = 2.04;
        x = exp(*y);
/*        x1 = r_exp_(y);    THIS IS WRONG!!! */
        ASSIGNFLOAT(x1, r_exp_(y)); /* the right way to call function */
        printf ("double prec: %f - single prec: %f \n", x, x1);
}

Many thanks to all who kindly answered me:

dgh at validgh.com
pln at egret1.Stanford.EDU
turtle at sciences.sdsu.edu (Andrew Scherpbier)
poffen at sj.ate.slb.com (Russ Poffenberger)
Brent Alan Wiese <brent at curie.ssctr.bcm.tmc.edu>
edmund at syd.dms.csiro.au
i2unix!erix.ericsson.se!per (Per Hedeland)

Regards,        .mau.



More information about the Comp.sys.sun mailing list