0
decimal module in Python.
There is no proper description about decimal module and Decimal() ion internet. import decimal x='3.3' y=3.3 a=decimal.Decimal(x) b=decimal.Decimal(a) c=decimal.Decimal(y) print(x,type(x)) print(y,type(y)) print(a,type(a)) print(b,type(b)) print(c,type(c)) Why a=3.3 and b=3.29999......... ? How does Decimal() function works >
3 Réponses
+ 6
Try
import decimal
help(decimal)
And here's a link to the non-existing proper description: https://docs.python.org/3/library/decimal.html 🤓
+ 3
Also, you wrote it wrong. a and b are both 3.3. c is 3.299..., because it's been converted from a float (y), so the internal value of that float is taken. This is also explained in proper detail in the docs Anna linked.
0
Anna I have already seen it but it is not proper. Also it is the only document which has some detail about decimal. Other websites shows functions in decimal module only.