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

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -