PBXB64 Science & Math

80+ Functions PBXB64 Addition

A complete scientific computing toolkit built into the compiler. No external libraries needed. Covers trigonometry, linear algebra, statistics, random numbers, hyperbolic functions, DEC128/RATIONAL conversion, and more.

Function Reference

SIN / COS / TANTrigonometric (radians)
ATN / ATN2Arc-tangent (1-arg, 2-arg)
SINH / COSH / TANHHyperbolic functions
ASINH / ACOSH / ATANHInverse hyperbolic
EXP / LOG / LOG10Exponential, natural log, base-10
SQR / CBRTSquare root, cube root
HYPOTHypotenuse: sqrt(x² + y²)
ABS / FIX / INTAbsolute, truncate, floor
CEIL / FLOOR / ROUNDRounding functions
SIGN / SGNSign of number
MIN / MAXMinimum / maximum
RND / RNDGAUSSUniform & Gaussian random
RANDOMIZE / RNGSEEDSeed random generator
RNGDEFAULTReset to default seed
DET / DET2Matrix determinant
DOT / NORMVector dot product, Euclidean norm
PIConstant 3.14159...
DEG / RADDegrees ↔ radians
DEC128 / RATIONALConversion functions
ISCLOSENear-equality test

Linear Algebra: DET, DOT, NORM

Matrix & vector operations
FUNCTION PBMAIN() AS LONG LOCAL m11 AS DOUBLE, m12 AS DOUBLE LOCAL m21 AS DOUBLE, m22 AS DOUBLE LOCAL det AS DOUBLE m11 = 4.0 : m12 = 7.0 m21 = 2.0 : m22 = 6.0 det = DET2(m11, m12, m21, m22) ' 4*6 - 7*2 = 10 PRINT "Determinant: "; det ' 10.0 LOCAL a1 AS DOUBLE, a2 AS DOUBLE LOCAL b1 AS DOUBLE, b2 AS DOUBLE LOCAL dot AS DOUBLE a1 = 1.0 : a2 = 2.0 b1 = 3.0 : b2 = 4.0 dot = DOT(a1, a2, b1, b2) ' 1*3 + 2*4 = 11 PRINT "Dot product: "; dot ' 11.0 FUNCTION = 0 END FUNCTION

DET2 computes a 2×2 determinant. DOT computes the dot product of two vectors. NORM returns the Euclidean length.

Random Numbers: RND, RNDGAUSS, RNGSEED

Seeded random generation
FUNCTION PBMAIN() AS LONG LOCAL r AS DOUBLE LOCAL g AS DOUBLE RNGSEED 12345 ' Reproducible seed r = RND() ' Uniform [0, 1) PRINT "Uniform: "; r g = RNDGAUSS() ' Gaussian (mean=0, std=1) PRINT "Gaussian: "; g RNGDEFAULT ' Reset to default seed FUNCTION = 0 END FUNCTION

RNGSEED sets a deterministic seed for reproducible results. RNDGAUSS uses the Box-Muller transform for Gaussian-distributed random numbers.

Hyperbolic Functions

SINH, COSH, TANH, ASINH, ACOSH, ATANH
FUNCTION PBMAIN() AS LONG LOCAL x AS DOUBLE LOCAL s AS DOUBLE LOCAL c AS DOUBLE x = 1.0 s = SINH(x) ' 1.1752... c = COSH(x) ' 1.5430... PRINT "sinh(1) = "; s PRINT "cosh(1) = "; c PRINT "tanh(1) = "; TANH(x) ' Inverse hyperbolic PRINT "asinh(1.1752) = "; ASINH(s) FUNCTION = 0 END FUNCTION

Full hyperbolic suite including inverse variants. All implemented natively in the runtime.

ATN2 - Two-Argument Arc-Tangent

ATN2 - correct quadrant
FUNCTION PBMAIN() AS LONG LOCAL angle AS DOUBLE angle = ATN2(1.0, 1.0) ' 45 degrees (PI/4) PRINT "ATN2(1, 1) = "; angle angle = ATN2(-1.0, -1.0) ' -135 degrees (-3PI/4) PRINT "ATN2(-1, -1) = "; angle angle = ATN2(0.0, -1.0) ' 180 degrees (PI) PRINT "ATN2(0, -1) = "; angle FUNCTION = 0 END FUNCTION

ATN2(y, x) returns the angle in the correct quadrant, unlike ATN(y/x) which loses quadrant information.

Back to feature list