Python cdecimal InvalidOperation
问题 I am trying to read financial data and store it. The place I get the financial data from stores the data with incredible precision, however I am only interested in 5 figures after the decimal point. Therefore, I have decided to use t = .quantize(cdecimal.Decimal('.00001'), rounding=cdecimal.ROUND_UP) on the Decimal I create, but I keep getting an InvalidOperation exception. Why is this? >>> import cdecimal >>> c = cdecimal.getcontext() >>> c.prec = 5 >>> s = '45.2091000080109' >>> # s = '0