1 /* 2 * Copyright (c) 2019 Vestas Wind Systems A/S 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <math.h> 8 sqrt(double value)9double sqrt(double value) 10 { 11 double sqrt = value / 3; 12 int i; 13 14 if (value <= 0) { 15 return 0; 16 } 17 18 for (i = 0; i < 6; i++) { 19 sqrt = (sqrt + value / sqrt) / 2; 20 } 21 22 return sqrt; 23 } 24