Am 23.03.20 um 14:45 schrieb James Foster:

On Mar 23, 2020, at 6:06 AM, Sven Van Caekenberghe <s...@stfx.eu> wrote:

What you found out now is that the clever trick used to avoid picking an 
additive identity (picking an element, counting it twice and then subtracting 
it) leads to a loss of precision when floating point numbers are involved. This 
is an important issue.

If this approach is to be preserved, then each class should have an additive 
identity so instead of adding and subtracting an object, we let the object tell 
us its zero.

Or define a singleton class "Zero" with a + method that returns the other operand, and use that Zero object for the additive identity.

Konrad.


Reply via email to