Standard Library - Advanced Math

Exponential and logarithmic functions

Overview

Advanced mathematical functions including exponential (e^x) and natural logarithm (ln). All values use fixed-point scaling by 1000.

Available Functions

exp

Calculates e^x (exponential function) using Taylor series expansion.

Taylor Series: e^x = 1 + x + x²/2! + x³/3! + x⁴/4! + ...

Input Output
R0 = x (scaled by 1000) R0 = e^x (scaled by 1000)
Example:
; Calculate e^1 ≈ 2.718
LOAD R0, 1000    ; x = 1.000
CALL exp
PRINT R0         ; Outputs ~2718 (2.718)

ln

Calculates the natural logarithm ln(x) using an approximation method.

Note: x must be > 0

Input Output
R0 = x (scaled by 1000, must be > 0) R0 = ln(x) (scaled by 1000)
Example:
; Calculate ln(2.718) ≈ 1.000
LOAD R0, 2718    ; x = 2.718
CALL ln
PRINT R0         ; Outputs ~1000 (1.000)

Related Documentation