What happened to trig functions in math.h?

Dan Brown plug-discuss@lists.PLUG.phoenix.az.us
Thu, 12 Jul 2001 07:42:57 -0700


On Wed, Jul 11, 2001 at 09:41:05PM -0700, Shawn T. Rutledge wrote:
> Date: Wed, 11 Jul 2001 21:41:05 -0700
> From: "Shawn T. Rutledge" <ecloud@bigfoot.com>
> To: plug-discuss@lists.PLUG.phoenix.az.us
> Subject: What happened to trig functions in math.h?
> 
> I'm trying to compile a program which depends on sin and cos, and they're
> not in math.h!  I don't believe it.  The man page for cos even says it's
> in math.h.  I'm running Debian of course.
> 

It's been a long time since I did any C but did you link to the math
library (libm.so)?

I'm running Debian (potato) and this little but of code works on
my machine using

   cc -o sin sin.c -lm

to compile.

   #include <stdio.h>
   #include <math.h>
   
   int main( void ) {
   
      double s_output, c_output;
   
      s_output = sin( 1.7 );
      c_output = cos( 1.7 );
   
      printf( "The sin is %f\nThe cos is %f\n", s_output, c_output );
      return 0;
   }

Hope that helps.

Dan