In Scala 2.10, is someDouble.isNaN
expected to box? Running my code calling .isNaN
through a decompiler, I still see telltale calls to double2Double
in my code. Given the new AnyVal
work in 2.10, I'd expect it to be no worse than java.lang.Double.isNaN(someDouble)
at runtime with no spurious allocations. Am I missing something?
相关问题
- Unusual use of the new keyword
- Get Runtime Type picked by implicit evidence
- What's the point of nonfinal singleton objects
- PlayFramework: how to transform each element of a
- Error in Scala Compiler: java.lang.AssertionError:
相关文章
- Gatling拓展插件开发,check(bodyString.saveAs("key"))怎么实现
- RDF libraries for Scala [closed]
- Why is my Dispatching on Actors scaled down in Akk
- How do you run cucumber with Scala 2.11 and sbt 0.
- GRPC: make high-throughput client in Java/Scala
- Setting up multiple test folders in a SBT project
- Testing request with CSRF Token in Play framework
- Run project with java options via sbt
Unfortunately,
isNaN
is a method onjava.lang.Double
, and it is essential to have an implicit conversion tojava.lang.Double
, so the ScalaRichDouble
value class cannot reimplementisNaN
to be fast, and when you useisNaN
you box tojava.lang.Double
.Since this leaves only slow or awkward ways to test for
NaN
, I defineand then I can just use
.nan
to check.