2023-09-14 10:35:11 -05:00
|
|
|
var constants = include "constants";
|
|
|
|
|
|
|
|
func square_root(value){
|
|
|
|
match value{
|
|
|
|
0..1 -> return value;
|
|
|
|
value -> {
|
|
|
|
var y = x;
|
|
|
|
var z = (y + (x/y)) / 2;
|
|
|
|
// NOTE: not finalized syntax
|
|
|
|
while abs(y - z) >= 0.00001{
|
|
|
|
y = z
|
|
|
|
z = (y + (x/y)) / 2
|
|
|
|
}
|
|
|
|
return z;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var sqrt = square_root;
|
|
|
|
var √ = square_root;
|
|
|
|
|
|
|
|
func absolute_value(value){
|
|
|
|
|
|
|
|
}
|
|
|
|
var abs = absolute_value;
|