-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_sqrt.c
26 lines (24 loc) · 1.02 KB
/
ft_sqrt.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sqrt.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dbrophy <dbrophy@student.42.us.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/21 15:21:21 by dbrophy #+# #+# */
/* Updated: 2020/02/21 15:21:21 by dbrophy ### ########.fr */
/* */
/* ************************************************************************** */
double ft_sqrt(double val)
{
double n;
double l;
n = val / 2.0;
l = 0;
while (n != l)
{
l = n;
n = (n + val / n) / 2.0;
}
return (n);
}