[comp.lang.c] SunSparc 1+ C question

kristi@cscsun1.larc.nasa.gov (kristi skeens) (12/20/90)

I need help! I am trying to use the C function pow on a Sparc 1+, but with
no success.  I have included math.h and libmp.a, and declared the function and its
arguments to be double as the man page said, but get a segmentation fault at the
call. I have no documentation on this except the man page, so any words of
wisdom would be appreciated.

Thanks in advance,
kristi
--
kristi@cscsun1.larc.nasa.gov
"everything is relative"

eager@ringworld.Eng.Sun.COM (Michael J. Eager) (12/21/90)

In article <1990Dec19.185313.1116@abcfd20.larc.nasa.gov> kristi@cscsun1.larc.nasa.gov (kristi skeens) writes:
>I need help! I am trying to use the C function pow on a Sparc 1+, but with
>no success.  I have included math.h and libmp.a, and declared the function and its
>arguments to be double as the man page said, but get a segmentation fault at the
>call. I have no documentation on this except the man page, so any words of
>wisdom would be appreciated.


Not sure why you can't use the pow function.  Make sure that both arguments
are floats.  It seems to be simple:

ringworld[123] cat t.c
#include <stdio.h>
#include <math.h>

main ()
{
   float pi = 3.14159;

   printf ("pi = %f, pi**3 = %f\n", pi, pow(pi,3.0));
}


ringworld[124] cc t.c
ringworld[125] a.out
pi = 3.141590, pi**3 = 31.006202