1
Output :-
8.881784197e-16

I want the same output in decimal form

Tried

def sqrt(value):
    num = 1
    while (value):
        num = num * 2
        value = value -1
    return num

num =  1 / float (square)
print float(num)

Note: square value changing from 1 to 100 so expected output is to get the answer in full decimal form but it's coming in exponential form

1 Answers1

1

To display all the digits you can try formatting:

print "%.25f" % a
# -0.0000000000000008881784197

where 25 is the number of digits after the point. You can change it.

Christian Tapia
  • 33,620
  • 7
  • 56
  • 73