Message248246
round(1.65, 1) return 1.6 with decimal.
I feel bug adobe result.
not bug ?
>>> import decimal
>>> d1 = decimal.Decimal("1.65")
>>> d2 = decimal.Decimal(10 ** -2) * 5
>>> d1
Decimal('1.65')
>>> d2
Decimal('0.05000000000000000104083408559')
>>> d1 + d2
Decimal('1.700000000000000001040834086')
>>> data = list(map(decimal.Decimal, "1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95".split()))
>>> for x in data:
... print("round({}, 1) = {}".format(x, round(x, 1)))
...
round(1.05, 1) = 1.0
round(1.15, 1) = 1.2
round(1.25, 1) = 1.2
round(1.35, 1) = 1.4
round(1.45, 1) = 1.4
round(1.55, 1) = 1.6
round(1.65, 1) = 1.6
round(1.75, 1) = 1.8
round(1.85, 1) = 1.8
round(1.95, 1) = 2.0
>>> round(2.675, 2)
2.67
>>> d4 = decimal.Decimal("2.675")
>>> round(d4, 2)
Decimal('2.68') |
|
Date |
User |
Action |
Args |
2015-08-08 03:02:04 | umedoblock | set | recipients:
+ umedoblock |
2015-08-08 03:02:04 | umedoblock | set | messageid: <1439002924.0.0.989734122739.issue24827@psf.upfronthosting.co.za> |
2015-08-08 03:02:03 | umedoblock | link | issue24827 messages |
2015-08-08 03:02:03 | umedoblock | create | |
|