-- Bisection method for solving non-linear equations. -- Adapted for lua2wasm: globals are explicitly declared up front; everything -- else is byte-for-byte the original. global delta = 1e-6 global n global bisect global solve global f function bisect(f,a,b,fa,fb) local c=(a+b)/2 io.write(n," c=",c," a=",a," b=",b,"\n") if c==a or c==b or math.abs(a-b)