dashboard
repositories
filestore
activity
search
login
python-kurs
/
example-projects-2024
example-projects-2024
summary
reflog
commits
tree
tickets
docs
forks
compare
blame
|
history
|
raw
add bsp while
Hong-Phuc Bui
2024-04-21
a748a17c7285910b32617850cb52d9a048bcbd46
[python-kurs/example-projects-2024.git]
/
python-grundlage
/
sqrt-newton.py
1
2
3
4
5
6
7
8
9
10
import sys
n = float(sys.argv[1])
EPSILON = sys.float_info.epsilon
t = n
while abs(t - n/t) > (EPSILON*t):
t = (n / t + t) / 2
print(f"sqrt({n}) ~= {t}")