5 ms·
Correctness. Hmm. See other comments below where co-founder of Typesafe (who has quit) gave a talk explaining why Scala is doing everything wrong. In his vid
by yapcguy 13y ago
Correctness. Hmm.
See other comments below where co-founder of Typesafe (who has quit) gave a talk explaining why Scala is doing everything wrong.
In his video he has a slide with the words "No wonder nothing works" and on the slide:
scala> val x1: Float = Long.MaxValue
x1: Float = 9.223372E18
scala> val x2: Float = Long.MaxValue - Int.MaxValue
x2: Float = 9.223372E18
scala> println(x1 == x2)
true
This is the guy who has worked on the Scala compiler. He says it will never be fast and there are things which are fundamentally broken (like above, and there are many more).
I think any start-up using Scala is making a big mistake.
- noelwelsh 13y agoA Long is 64 bits. An Int is 32 bits. A Float is 32 bits (8 bits exponent, 23 fraction, 1 sign). I don't see how anyone could expect a Float to have enough bits to represent the difference. The only different behaviour I can envisage is an error, but it is standard practice to disable these for performance reasons.
- bad_user 13y agoA Float on the other hand, by definition, is only an approximation. You can use fixed-point numbers, but they are either too slow or lack the required precision. > val x: BigDecimal = Long.MaxValue Problem solved. Or is it?
- bad_user 13y ago> co-founder of Typesafe (who has quit) gave a talk explaining why Scala is doing everything wrong If that's what you've understood from that talk, then you haven't heard basically anything he said. > val x1: Float = Long.MaxValue OK, I'll byte, name your (safe for startups) programming language that presumably doesn't do that.
- lmm 13y agoThat's standard IEEE 754 floating-point behavior. Almost all languages will do that (and languages that use bignums by default have their own problems). If you want more accurate floating-point (at a cost in performance) you can use Spire. > This is the guy who has worked on the Scala compiler. He says it will never be fast and there are things which are fundamentally broken (like above, and there are many more). He also says it's the best language available at the moment. And he's right.