Skip to content

Commit

Permalink
#1 {Code} - Adding implementation for Floor and Square Root
Browse files Browse the repository at this point in the history
  • Loading branch information
acorbin3 authored Jan 29, 2019
1 parent 183b930 commit 5418167
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions 5_Software/math_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,23 @@ def pow_native(number, exponent):
total += number
return total

def floor():
print("TODO - Add implementation")
def floor(initial):
return int(initial)

def sine():
print("TODO - Add implementation")

def cosine():
print("TODO - Add implementation")

def square_root():
print("TODO - Add implementation")
def square_root(x):
epsilon = 0.01
left = 0
right = x
guess = (right+left)/2.0
while abs(guess**2 - x) > :
if guess**2 < x:
left = guess
else:
right = guess
guess = (right+left)/2.0

0 comments on commit 5418167

Please sign in to comment.