# Double! implicitly converted to Int

**URL:** <https://discuss.kotlinlang.org/t/double-implicitly-converted-to-int/1545>\
**Category:** Support\
**Created:** [March 18, 2016, 12:50pm UTC](https://discuss.kotlinlang.org/t/double-implicitly-converted-to-int/1545 "2016-03-18T12:50:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![parkhujm](https://avatars.discourse-cdn.com/v4/letter/p/49beb7/32.png) [@parkhujm](https://discuss.kotlinlang.org/u/parkhujm)\
**Post date:** [March 18, 2016, 12:50pm UTC](https://discuss.kotlinlang.org/t/double-implicitly-converted-to-int/1545/1 "2016-03-18T12:50:06Z")

</div>

If you have a Double! and you compare it to an Int, it acts like Kotlin converts the Double! to Int first (truncating it), and then compares. Consider the following example:

Java:  
public class Holder {  
private Double value;  
public Holder(Double value) { this.value = value; }  
public Double getValue() { return value; }  
}

Kotlin:  
fun main(args : Array) {  
val j = Holder(0.99)  
println(“j.value \> 0 = ${j.value \> 0}”)  
println(“j.value \> 0.0 = ${j.value \> 0.0}”)  
}

This prints:  
j.value \> 0 = false  
j.value \> 0.0 = true

Is this a bug or by design?

---

<div class="post-metadata">

**Author:** ![ilya.gorbunov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/ilya.gorbunov/32/1645_2.png) [@ilya.gorbunov](https://discuss.kotlinlang.org/u/ilya.gorbunov)\
**Post date:** [March 20, 2016, 11:00pm UTC](https://discuss.kotlinlang.org/t/double-implicitly-converted-to-int/1545/2 "2016-03-20T23:00:57Z")

</div>

For me it looks like a bug. I’ve filed an issue [https://youtrack.jetbrains.com/issue/KT-11514](https://youtrack.jetbrains.com/issue/KT-11514).  
Thanks for the report.
