🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #6671

SUMMARY: single prec functions in C

#6671
From: mau
Date: Thu, 24 Jan 1991 08:23
35 lines
1526 bytes
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@validgh.com
pln@egret1.Stanford.EDU
turtle@sciences.sdsu.edu (Andrew Scherpbier)
poffen@sj.ate.slb.com (Russ Poffenberger)
Brent Alan Wiese <brent@curie.ssctr.bcm.tmc.edu>
edmund@syd.dms.csiro.au
i2unix!erix.ericsson.se!per (Per Hedeland)

Regards,        .mau.
Technical Details
Message-ID: <1419@brchh104.bnr.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request
From: mau@alice.CSELT.STET.IT
Newsgroups: comp.sys.sun
Subject: SUMMARY: single prec functions in C
Keywords: Miscellaneous
Message-ID: <1419@brchh104.bnr.ca>
Date: 24 Jan 91 08:23:11 GMT
Sender: news@brchh104.bnr.ca
Organization: Sun-Spots
Lines: 35
Approved: Sun-Spots@rice.edu
X-Sun-Spots-Digest: Volume 10, Issue 29, message 12
X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu