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

Implements the OP_LOG10 opcode using C99 math.h log10(). More...

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

Go to the source code of this file.

Functions

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

Variables

case OP_LOG10
 else
 break

Detailed Description

Implements the OP_LOG10 opcode using C99 math.h log10().

Behavior:

  • Pops one numeric operand (int or float).
  • If x <= 0, pushes NaN; else pushes log10(x) as VAL_FLOAT.

Stack effect:

  • Pop: x
  • Push: log10(x) | NaN

Definition in file log10.c.

Function Documentation

◆ exit()

exit(1)

◆ if()

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

Definition at line 27 of file log10.c.

Here is the call graph for this function:

Variable Documentation

◆ break

break

Definition at line 40 of file log10.c.

◆ else

else
Initial value:
{
fprintf(stderr, "Runtime type error: LOG10 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 36 of file log10.c.

◆ OP_LOG10

case OP_LOG10

Definition at line 25 of file log10.c.