When we have some instance of CalculusFieldElement, we can extract its real part using getReal().
It should be possible to extract the remaining parts (i.e. everything not in getReal()), lets call it the addendum, by calling getAddendum().
With such a method, we would always have e.getAddendum().add(e.getReal()) be equal to the original e.
Note, however, that e.subtract(e.getReal()) does not always returns e.getAddendum(). One counter-example (which is in fact the one that is the rationale behind this issue) is when e.getReal() is ±∞. When this happens, the subtraction e.subtract(e.getReal()) implies subtracting one infinity to itself, and this generates a NaN for the real part, not zero.
As this changes an interface, and as due to the handling of infinities we cannot provide a default implementation based on simple subtraction, this change should be done in a major release.
When we have some instance of
CalculusFieldElement
, we can extract its real part usinggetReal()
. It should be possible to extract the remaining parts (i.e. everything not ingetReal()
), lets call it theaddendum
, by callinggetAddendum()
.With such a method, we would always have
e.getAddendum().add(e.getReal())
be equal to the originale
.Note, however, that
e.subtract(e.getReal())
does not always returnse.getAddendum()
. One counter-example (which is in fact the one that is the rationale behind this issue) is whene.getReal()
is ±∞. When this happens, the subtractione.subtract(e.getReal())
implies subtracting one infinity to itself, and this generates aNaN
for the real part, not zero.As this changes an interface, and as due to the handling of infinities we cannot provide a default implementation based on simple subtraction, this change should be done in a major release.