How to fix the ZeroDivisionError with 1000 decimals digits output in Python?
How to fix the ZeroDivisionError with 1000 decimals digits output in Python? Question: In the following 2 examples: Example 1: from decimal import Decimal, getcontext getcontext().prec = 1000 d = Decimal(1+10**(-24)) 1/d.ln() Example 2: from mpmath import * mp.dps = 1000 mp.pretty=True 1/(ln(1+10**(-24))) I get the ZeroDivisionError. Python 3.7(64-bit) takes it as 1/ln(1) or 1/0. …