This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Why is this true: BigDecimal(1.1) == 1L

1 reply
Bryne McCullough
Joined: 2010-05-07,
User offline. Last seen 42 years 45 weeks ago.
I expected false in this case:

scala> BigDecimal(1.1) == 1
res51: Boolean = false

But, I was surprise to see true in this case:

scala> BigDecimal(1.1) == 1L
res52: Boolean = true

Any ideas why the 1 case is false, but the 1L case is true?

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: Why is this true: BigDecimal(1.1) == 1L

On Mon, May 17, 2010 at 04:13:00PM -0700, Bryne McCullough wrote:
> But, I was surprise to see true in this case:

It's a bug.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland