rspec/rules/S2127/java/rule.adoc

29 lines
728 B
Plaintext

== Why is this an issue?
``++Double.longBitsToDouble++`` expects a 64-bit, ``++long++`` argument. Pass it a smaller value, such as an ``++int++`` and the mathematical conversion into a ``++double++`` simply won't work as anticipated because the layout of the bits will be interpreted incorrectly, as if a child were trying to use an adult's gloves.
=== Noncompliant code example
[source,java]
----
int i = 42;
double d = Double.longBitsToDouble(i); // Noncompliant
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]