rspec/rules/S1940/comments-and-links.adoc

20 lines
721 B
Plaintext
Raw Normal View History

=== on 12 Nov 2015, 18:23:59 Linda Martin wrote:
OK!
=== on 27 Sep 2019, 15:55:21 Sergey Adamovski wrote:
It is wrong that \"``++!(a>2)++``" is equivalent to \"``++a<=2++``".
In case a == NaN (not a number), any compare to it will give "false". ``++(a>2) == false++`` and ``++(a<=2) == false++``. Therefore, "!(a>2)" will be ``++true++`` while "a+<=+2" ``++false++``.
Equivalent of \"``++!(a>2)++``" would be \"``++(a<=2) || (double.IsNaN(a))++``" or \"``++(a<=2) || (float.IsNaN(a))++``" which is easier to read but longer to execute.
One can
* check whether comparison contains any float/double values that can be Not-A-Number _or_
* at least warn a user that it is not the same _or_
* remove this restriction