maybe noob question but hope its fine to crosspost...
# multiplatform
c
maybe noob question but hope its fine to crosspost it here https://kotlinlang.slack.com/archives/C0B8L3U69/p1735516219702969
l
Float-to-string conversion calls into the platform implementation, so it works differently on both.
I faced the same issue and just implemented a custom function to ensure consistent behaviour.
👍 1
c
That’s what I was doing now as well. I think it’s better to have consistency. On the one hand I see why it uses the platforms implementation on the other hand it feels a bit unexpected when a language behaves differently.
l
Yeah. What is really needed is a multiplatform string formatter.
👍 1
c
Agree, that would have helped a lot
d
Heh, who decides which form is “correct”? To me, the JS result (“25”) is clearly wrong. 😉
l
For Kotlin, that's definitely the case.
I think JS does what it does because it doesn't have integers, so it needs to fake it for numbers without decimals.
With that in mind, falling back to the platform default formatter seems to be an incorrect choice.