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:
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_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.

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
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 36 of file log10.c.

◆ OP_LOG10

case OP_LOG10

Definition at line 25 of file log10.c.