Oct-08-2021, 09:38 AM
I am writing a simple program to calculate the zero point for a function. However it will never find it because of rounding. Any suggestions of how this can be done? Thanks.
def function_g(x):
return ((2*x)-1)
counter=-10
while counter<10:
functionvalue=funksjon_g(counter)
if functionvalue==0 :
print("Zero point is ----------------> " + str(counter))
print("counter is " + str(counter) +" "+ str(function_g(counter)))
counter=counter+0.1
