24 lines
488 B
Plaintext
24 lines
488 B
Plaintext
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; |