mirror of
https://github.com/jeremysrand/abCalc.git
synced 2024-11-30 10:49:21 +00:00
47 lines
699 B
C
47 lines
699 B
C
|
/*
|
||
|
abCOpTan.c
|
||
|
By: Jeremy Rand
|
||
|
*/
|
||
|
|
||
|
|
||
|
#include <math.h>
|
||
|
#include <stdio.h>
|
||
|
|
||
|
#include "abCError.h"
|
||
|
#include "abCStack.h"
|
||
|
|
||
|
#include "expr/abCExpr.h"
|
||
|
#include "expr/abCExpReal.h"
|
||
|
|
||
|
#include "ops/abCOp.h"
|
||
|
#include "ops/abCOpTan.h"
|
||
|
|
||
|
|
||
|
#define TAN_NAME "TAN"
|
||
|
|
||
|
|
||
|
static void tanExecute(void);
|
||
|
|
||
|
|
||
|
void abCalcOpTanInit(void)
|
||
|
{
|
||
|
abCalcOpRegister(TAN_NAME, tanExecute);
|
||
|
}
|
||
|
|
||
|
|
||
|
void tanExecute(void)
|
||
|
{
|
||
|
abCalcExpr result;
|
||
|
AB_CALC_OP_ONE_ARG(TAN_NAME);
|
||
|
|
||
|
if (expr->type != abCalcExprTypeReal) {
|
||
|
abCalcRaiseError(abCalcBadArgTypeError, TAN_NAME);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
abCalcExprRealSet(&result, tan(expr->u.real));
|
||
|
|
||
|
abCalcStackExprPop(NULL);
|
||
|
abCalcStackExprPush(&result);
|
||
|
}
|