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

Implements the OP_FMIN opcode using C99 math.h fmin(). Accepts int or float; follows IEEE-754 NaN handling per fmin. More...

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

Go to the source code of this file.

Functions

 if (!((a.type==VAL_INT||a.type==VAL_FLOAT) &&(b.type==VAL_INT||b.type==VAL_FLOAT)))
 if (!isnan(r) &&!isinf(r) &&r >=(double) INT64_MIN &&r<=(double) INT64_MAX)
 free_value (a)
 free_value (b)
 push_value (vm, out)

Variables

case OP_FMIN
Value a = pop_value(vm)
double da = (a.type == VAL_FLOAT) ? a.d : (double)a.i
double db = (b.type == VAL_FLOAT) ? b.d : (double)b.i
double r = fmin(da, db)
Value out
 else
 break

Detailed Description

Implements the OP_FMIN opcode using C99 math.h fmin(). Accepts int or float; follows IEEE-754 NaN handling per fmin.

Definition in file fmin.c.

Function Documentation

◆ free_value() [1/2]

free_value ( a )

◆ free_value() [2/2]

free_value ( b )

◆ if() [1/2]

if ( ! (a.type==VAL_INT||a.type==VAL_FLOAT) &&(b.type==VAL_INT||b.type==VAL_FLOAT))

Definition at line 21 of file fmin.c.

◆ if() [2/2]

if ( !isnan(r) &&!isinf(r) &&r >=(double) INT64_MIN &&r<=(double) INT64_MAX)

Definition at line 30 of file fmin.c.

◆ push_value()

push_value ( vm ,
out  )

Variable Documentation

◆ a

Value a = pop_value(vm)

Definition at line 20 of file fmin.c.

◆ break

break

Definition at line 42 of file fmin.c.

◆ da

double da = (a.type == VAL_FLOAT) ? a.d : (double)a.i

Definition at line 26 of file fmin.c.

◆ db

double db = (b.type == VAL_FLOAT) ? b.d : (double)b.i

Definition at line 27 of file fmin.c.

◆ else

else
Initial value:
{
Value out
Definition apop.c:38
uint32_t r
Definition band.c:33
Value make_float(double v)
Construct a Value representing a double-precision float.
Definition value.c:64

Definition at line 36 of file fmin.c.

◆ OP_FMIN

case OP_FMIN

Definition at line 18 of file fmin.c.

◆ out

Value out

Definition at line 29 of file fmin.c.

◆ r

double r = fmin(da, db)

Definition at line 28 of file fmin.c.