commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Commented] (NUMBERS-45) Removal of isNaN() and isInfinite() methods from Complex class
Date Thu, 22 Jun 2017 13:05:00 GMT


Gilles commented on NUMBERS-45:

Can't we keep them as syntactic sugar (with the Javadoc mentioning that _they must not be
used within methods that aims to comply with the standard_)?

> Removal of isNaN() and isInfinite() methods from Complex class
> --------------------------------------------------------------
>                 Key: NUMBERS-45
>                 URL:
>             Project: Commons Numbers
>          Issue Type: Improvement
>    Affects Versions: 1.0
>            Reporter: Eric Barnhill
>            Priority: Minor
>             Fix For: 1.0
> Complex() currently contains the methods isNaN() and isInfinite() which return positive
when either the real or the imaginary components of the Complex number are infinite. They
are principally used as a "short circuit" in many of the methods, that is, isNaN() is checked
and if true, Complex.NaN is returned without further processing.
> isNaN() and isInfinite() should be removed from Complex. For the purposes of ISO C standards,
nearly all methods need to handle arguments and return values in which either real or imaginary
is NaN or Infinite, but not both. Thus this quick "sanity check" prevents Commons from complying
with ISO C standards. 
> It is easy enough to check whether the fields Complex.real and Complex.imaginary with
Double.isNaN() or Double.isInfinite() if comparison is desired.
> These methods then need to be removed from certain tests in ComplexTest which call the
isNaN() or isInfinite() methods. Most of these methods are superseded by the new C standard
tests anyway.

This message was sent by Atlassian JIRA

View raw message