

Multiplication, the “schoolbook” approach uses all the figures in the This is the customary presentation for monetary applications. The trailing zero is kept to indicate significance.

The decimal module incorporates a notion of significant places so that 1.30 + 1.20 is 2.50.

Reason, decimal is preferred in accounting applications which have strict Prevent reliable equality testing and differences can accumulate. In decimal floating point, 0.1 + 0.1 + 0.1 - 0.3 is exactly equal to zero. The exactness carries over into arithmetic. End users typically would not expect 1.1 + 2.2 to displayĪs 3.3000000000000003 as it does with binary floating point. In contrast, numbers likeġ.1 and 2.2 do not have exact representations in binaryįloating point. People learn at school.” – excerpt from the decimal arithmetic specification.ĭecimal numbers can be represented exactly. Provide an arithmetic that works in the same way as the arithmetic that In mind, and necessarily has a paramount guiding principle – computers must It offers several advantages over theĭecimal “is based on a floating-point model which was designed with people The decimal module provides support for fast correctly roundedĭecimal floating point arithmetic. Decimal - Decimal fixed point and floating point arithmetic ¶
