/****************************************************************/
/*                                                              */
/*          Math package  -  version 26.12.88                   */
/*                                                              */
/****************************************************************/

#include "comal/comal.h"

extern CmlFlt CmlDiv(), CmlCos(), CmlSin();

CmlFlt unit = 1;                  /* 1 as integer               */

void cot(wrkspc,wrktop)           /* cot(x) = cos(x)/sin(x)     */
CmlFlt  *wrkspc,*wrktop;          /* pointers to workspace      */
{
  CmlFlt x,a,b,value;             /* Floating point variables   */

  WorkBot = (APTR)wrkspc;         /* Set work space bottom ..   */
  WorkTop = (APTR)wrktop;         /* .. and top                 */

  x = *(--wrkspc);                /* x = aktual parameter       */
  a = CmlCos(x);
  b = CmlSin(x);
  value = b/a;
  RetValue(&value);               /* Return                     */
}

void inv(wrkspc,wrktop)           /* inv(x) = 1/x               */
CmlFlt  *wrkspc,*wrktop;          /* pointers to workspace      */
{
  CmlFlt x,value;                 /* Floating point variables   */

  WorkBot = (APTR)wrkspc;         /* Set work space bottom ..   */
  WorkTop = (APTR)wrktop;         /* .. and top                 */

  x = *(--wrkspc);                /* x = aktual parameter       */
  value = unit/x;
  RetValue(&value);               /* Return                     */
}


                              /**********************************/
struct varnode invlnk = {     /* Identifier table for inv       */
  0L,                         /* Last link                      */
  "INV",                      /* Name                           */
  fltcode,                    /* Type                           */
  1                      };   /* one argument                   */
UWORD invpar1 = fltval;       /* Float value parameter          */
void (*invrout)() = &inv;     /* Routine address                */
                              /**********************************/

                              /**********************************/
struct varnode cotlnk = {     /* Identifier table for cotangens */
  &invlnk,                    /* Link to next procedure head    */
  "COT",                      /* Name                           */
  fltcode,                    /* Type                           */
  1                      };   /* one argument                   */
UWORD cotpar1 = fltval;       /* Float value parameter          */
void (*cotrout)() = &cot;     /* Routine address                */
                              /**********************************/

topptr topnode = &cotlnk;     /* Top link points to cotlnk      */

void init(pck)
struct package *pck;
{
  pck->var = &topnode;        /* Initialise top-id link         */
}
