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.MIN_VALUE are 64 bit values that conflict with documentation.
This is bad when your working with
DataView. For example:
val buff = ArrayBuffer(4) val dv = DataView(buff) dv.setFloat32(0, Float.MAX_VALUE) println(dv.getFloat32(0))
Infinity, that is wrong.
Max and min values are specified here 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.