formatting

This commit is contained in:
Johannes Loher 2018-06-07 22:17:43 +02:00
parent e972fd631e
commit 2d43ed3eda

View file

@ -1394,11 +1394,11 @@ import std.stdio : writeln;
auto sqrt(T)(T x) { auto sqrt(T)(T x) {
enum GoodEnough = 0.01; enum GoodEnough = 0.01;
import std.math : abs; import std.math : abs;
T z = x*x, old = 0; T z = x * x, old = 0;
int iter; int iter;
while (abs(z - old) > GoodEnough) { while (abs(z - old) > GoodEnough) {
old = z; old = z;
z -= ((z*z)-x) / (2*z); z -= ((z * z) - x) / (2 * z);
} }
return z; return z;