[comp.sys.amiga.tech] SAS 5.10 printf

igor@pnet51.orb.mn.org (Peter Dufault) (10/20/90)

  I have a problem with using printf() in SAS 5.10.
For example, the following code:

#include <stdio.h>

double test;

main()
{
        test=1.6;
        printf(" %g \n",test);
}

will simply print "%g" on the screen. Printing integers using %d works
perfectly fine, however. Anyone else had this problem? Anyone willing to test
it?


UUCP: {amdahl!bungia, uunet!rosevax, crash}!orbit!pnet51!igor
ARPA: crash!orbit!pnet51!igor@nosc.mil
INET: igor@pnet51.orb.mn.org

shawn@marilyn.UUCP (Shawn P. Stanley) (10/21/90)

In article <3347@orbit.cts.com> igor@pnet51.orb.mn.org (Peter Dufault) writes:
>will simply print "%g" on the screen. Printing integers using %d works
>perfectly fine, however.

Perhaps it isn't linking in the routines from the floating-point library.
You could try assigning a value to the variable 'test', or make sure your
floating-point library is specified before your standard library.
--
Shawn P. Stanley         shawn@marilyn.marilyn.mn.org
bungia!marilyn!shawn     {rosevax,crash}!orbit!marilyn!shawn

dewolfe@ug.cs.dal.ca (Colin DeWolfe) (10/21/90)

In article <3347@orbit.cts.com> igor@pnet51.orb.mn.org (Peter Dufault) writes:
>
>  I have a problem with using printf() in SAS 5.10.
>For example, the following code:
>
>#include <stdio.h>
>
>double test;
>
>main()
>{
>        test=1.6;
>        printf(" %g \n",test);
>}
>
>will simply print "%g" on the screen. Printing integers using %d works
>perfectly fine, however. Anyone else had this problem? Anyone willing to test
>it?

I don't have 5.10 (yet) but I think I know what your problem is.
Try linking in the appropriate math library (it should be the first library 
scanned during linking) be it lcm881, lcmieee or simply lcm (depending on
your -f argument in the lc command line).

>
>
>UUCP: {amdahl!bungia, uunet!rosevax, crash}!orbit!pnet51!igor
>ARPA: crash!orbit!pnet51!igor@nosc.mil
>INET: igor@pnet51.orb.mn.org

Colin DeWolfe
dewolfe@ug.cs.dal.ca
dewolfe@iris1.ucis.dalc.ca