/* | |
* Copyright (c) 2019 Vestas Wind Systems A/S | |
* | |
* SPDX-License-Identifier: Apache-2.0 | |
*/ | |
#include <math.h> | |
double sqrt(double value) | |
{ | |
double sqrt = value / 3; | |
int i; | |
if (value <= 0) { | |
return 0; | |
} | |
for (i = 0; i < 6; i++) { | |
sqrt = (sqrt + value / sqrt) / 2; | |
} | |
return sqrt; | |
} |