Float division of big numbers in python -


i have 2 big numbers a , b of length around 10000, such a <= b. now, have find c = / b, upto 10 places of decimal, how do without loosing precision?

the decimal module should work. seen in tigerhawkt3's link, can choose number of decimal places quotient should be.

from decimal import * getcontext().prec = 6 = float(raw_input('the first number:'))       #can int() if needed b = float(raw_input('the second number:')) c = decimal(a) / decimal(b) print float(c) 

Comments

Popular posts from this blog

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

php - Using str_replace to translate a MySQL Table in html -

asp.net mvc - Cannot display error message on Editor or EditorFor -