Fun 0.41.5
The programming language that makes you have fun!
Loading...
Searching...
No Matches
tan.c File Reference

Implements the OP_TAN opcode using C99 math.h tan(). More...

#include <math.h>
Include dependency graph for tan.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 if (v.type==VAL_INT||v.type==VAL_FLOAT)
 exit (1)

Variables

case OP_TAN
 else
 break

Detailed Description

Implements the OP_TAN opcode using C99 math.h tan().

VM opcode snippet included by vm.c. Provides tangent function.

Behavior:

  • Pops one numeric operand (int or float) from the stack.
  • Computes tan(x) in double precision.
  • Always pushes a VAL_FLOAT result.

Stack effect:

  • Pop: x
  • Push: tan(x)

Types:

  • Accepts VAL_INT and VAL_FLOAT; others cause a runtime error.

Definition in file tan.c.

Function Documentation

◆ exit()

exit ( 1 )

◆ if()

if ( v. type = VAL_INT || v.type == VAL_FLOAT)

Definition at line 33 of file tan.c.

Variable Documentation

◆ break

break

Definition at line 42 of file tan.c.

◆ else

else
Initial value:
{
fprintf(stderr, "Runtime type error: TAN expects number, got %s\n", value_type_name(v.type))
Value v
Definition cast.c:22
static const char * value_type_name(ValueType t)
Get a human-readable name for a ValueType.
Definition vm.c:318
#define fprintf
Definition vm.c:200

Definition at line 38 of file tan.c.

◆ OP_TAN

case OP_TAN

Definition at line 31 of file tan.c.