Python-数据类型-浮点类型
1 # 开发时间:2022/1/26 11:33 2 3 a = 3.14159 4 print(a, type(a)) 5 n1 = 1.1 6 n2 = 2.2 7 n3 = 2.1 8 9 print(n1+n2) 10 from decimal import Decimal 11 print(Decimal('1.1')+Decimal('2.2')) 12 13 print(n1+n3)
1 # 开发时间:2022/1/26 11:33 2 3 a = 3.14159 4 print(a, type(a)) 5 n1 = 1.1 6 n2 = 2.2 7 n3 = 2.1 8 9 print(n1+n2) 10 from decimal import Decimal 11 print(Decimal('1.1')+Decimal('2.2')) 12 13 print(n1+n3)