You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following example, a Float and a Double is compared with a Number. They are all equal, and == returns true.
However, the compiler gives the warning "comparing values of types Double and Number using `==' will always yield false" and this is not true!
scala>vald= (BigInt(1) <<64).toDouble
d:Double=1.8446744073709552E19
scala>valf:Float= d.toFloat
f:Float=1.8446744E19
scala>valn: java.lang.Number= d
n:Number=1.8446744073709552E19
scala> d == f
res37:Boolean=true
scala> d == n
<console>:10:warning: comparing values of types Double and Number using `==' will always yield false
d == n
^
res38:Boolean=true
scala> f == n
<console>:11:warning: comparing values of types Float and Number using `==' will always yield false
f == n
^
res39:Boolean=true
The text was updated successfully, but these errors were encountered:
In the following example, a
Float
and aDouble
is compared with aNumber
. They are all equal, and==
returnstrue
.However, the compiler gives the warning "comparing values of types Double and Number using `==' will always yield false" and this is not true!
The text was updated successfully, but these errors were encountered: