G2Basic 0.1.1 (1e793fc)
BASIC interpreter for microcontrollers
Loading...
Searching...
No Matches
Built-in function backends

Build-time choice of built-in functions, with or without libm. More...

Collaboration diagram for Built-in function backends:

Functions

void g2basic_init_math_functions (void)
 Register the built-in functions of the selected backend.
 

Detailed Description

Build-time choice of built-in functions, with or without libm.

CMake compiles exactly one backend source, selected by G2BASIC_ENABLE_MATH_FUNCTIONS and G2BASIC_ENABLE_MATH:

Backend ..._FUNCTIONS ..._MATH Registers libm
g2basic_math.c ON ON all 13 yes
g2basic_math_crude.c ON OFF all 13, approximated no
g2basic_math_none.c OFF any min, max no

The 13 functions are sin, cos, tan, sqrt, abs, pow, log, log10, exp, floor, ceil, min, and max. pow takes two arguments. min and max take up to eight and return 0 with none. The others take one.

Function Documentation

◆ g2basic_init_math_functions()

void g2basic_init_math_functions ( void  )

Register the built-in functions of the selected backend.

Called by g2basic_init() after it clears all registered functions. Host programs do not call it.