Math Toolkit

BambooBasic has a set of built-in math functions – Sin, Cos, Sqrt and friends. They are intrinsics: they compile straight to native math, so a purely computational program needs no runtime library at all. The same toolkit is what a PreCalc block uses to bake tables at compile time.

Trigonometry works in degrees.

Local h:Double = Sqrt(Pow(3, 2) + Pow(4, 2))   ' 5
Print "Sin(90) = " & ToString(Sin(90))          ' 1


The functions
Trigonometry (degrees)   Sin(a)   Cos(a)   Tan(a)
Inverse trig (-> degrees) ASin(x)  ACos(x)  ATan(x)   ATan2(y, x)
Powers & roots           Sqrt(x)  Cbrt(x)  Pow(base, exp)
Rounding                 Floor(x) Ceil(x)  Round(x)  Trunc(x)  Frac(x)
Sign & size              Abs(x)   Sgn(x)   Min(a, b) Max(a, b)
Exponential & logs       Exp(x)   Log(x)   Log10(x)
Angle conversion         DegToRad(d)  RadToDeg(r)
Constant                 Pi()

(Mod is the infix operator – a Mod b – not a function.)



Notes

Key Points

See Also

Examples

See MathToolkit.bam.


BambooBasic © 2026 Michael Denathorn