I’ve made a function, that actually calculates the sinus
(= math:sin (fn (x) (= x (% x (* math:pi 2))) (let n 1) (let q x) (let s 0) (while (< n math:sin-accuracy) (+= s q) (= q (/ (* q (* -1 (math:sqr x))) (* (+ (* 2 n) 1) (* 2 n)))) (++ n)) s))
also you have to have this defined
(= math:pi 3.141592)
(= math:sin-accuracy 12)
(= math:sqr (fn (a) (* a a)))
so cos and tan are
(= math:cos (fn (x) (= x (% x (* math:pi 2))) (* (math:sqrt (- 1 (math:sqr (math:sin x)))) (if (& (> x (/ math:pi 2)) (< x (+ (/ math:pi 2) math:pi))) -1 1))))
(= math:tan (fn (x) (= x (% x math:pi)) (/ (math:sin x) (math:cos x))))
for this you need sqrt (here is my bad algorythm)
(= math:sqrt (fn (a) (let i 0) (let ans (/ math:sqrtmaxval 2)) (let sub (/ math:sqrtmaxval 4)) (while (< i math:sqrtmaxiter) (= ans (+ ans (* sub (math:signz (- a (math:sqr ans)))))) (= sub (/ sub 2)) (++ i)) ans))
(= math:sqrtmaxiter 16)
(= math:sqrtmaxval 1024)