Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
exp.c File Reference

Implements the OP_EXP opcode using C99 math.h exp(). More...

#include <math.h>
Include dependency graph for exp.c:

Go to the source code of this file.

Functions

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

Variables

case OP_EXP
 else
 break

Detailed Description

Implements the OP_EXP opcode using C99 math.h exp().

VM opcode snippet included by vm.c. Provides the natural exponential function.

Behavior:

  • Pops one numeric operand (int or float).
  • Computes e^x in double precision.
  • Pushes a VAL_FLOAT result.

Stack effect:

Types:

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

Definition in file exp.c.

Function Documentation

◆ exit()

exit(1)

◆ if()

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

Definition at line 33 of file exp.c.

Here is the call graph for this function:

Variable Documentation

◆ break

break

Definition at line 42 of file exp.c.

◆ else

else
Initial value:
{
fprintf(stderr, "Runtime type error: EXP expects number, got %s\n", value_type_name(v.type))
Value v
Definition cast.c:22
#define fprintf
Definition vm.c:200

Definition at line 38 of file exp.c.

◆ OP_EXP

case OP_EXP

Definition at line 31 of file exp.c.