# Wrong Float.MIN\_VALUE and Float.MAX\_VALUE

**URL:** <https://discuss.kotlinlang.org/t/wrong-float-min-value-and-float-max-value/16574>\
**Category:** JavaScript\
**Created:** [March 3, 2020, 6:57am UTC](https://discuss.kotlinlang.org/t/wrong-float-min-value-and-float-max-value/16574 "2020-03-03T06:57:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Feamor](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/feamor/32/6977_2.png) [@Feamor](https://discuss.kotlinlang.org/u/Feamor)\
**Post date:** [March 3, 2020, 6:57am UTC](https://discuss.kotlinlang.org/t/wrong-float-min-value-and-float-max-value/16574/1 "2020-03-03T06:57:40Z")

</div>

I working on my own multiplatform binary protocol and have some common tests. When the edge cases tests failed on the JS I investigated problem and found some interesting thing. In KotlinJS `Float.MIN_VALUE == Double.MIN_VALUE == Number.MIN_VALUE` and `Float.MAX_VALUE == Double.MAX_VALUE == Number.MAX_VALUE`. It means that `Float.MAX_VALUE` and `Float.MIN_VALUE` are 64 bit values that conflict with documentation.

This is bad when your working with `ArrayBuffer` and `DataView`. For example:

```auto
val buff = ArrayBuffer(4)
val dv = DataView(buff)

dv.setFloat32(0, Float.MAX_VALUE)

println(dv.getFloat32(0))

```

prints `Infinity`, that is wrong.

Max and min values are specified here [kotlin/primitiveCompanionObjects.kt at master · JetBrains/kotlin · GitHub](https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/js/runtime/primitiveCompanionObjects.kt).

At the same time min and max values of Int, Short and Long are different between each other.

---

<div class="post-metadata">

**Author:** ![Feamor](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/feamor/32/6977_2.png) [@Feamor](https://discuss.kotlinlang.org/u/Feamor)\
**Post date:** [March 3, 2020, 8:19am UTC](https://discuss.kotlinlang.org/t/wrong-float-min-value-and-float-max-value/16574/2 "2020-03-03T08:19:43Z")

</div>

I added isuue to the Kotlin youtrack [https://youtrack.jetbrains.com/issue/KT-37175](https://youtrack.jetbrains.com/issue/KT-37175).
