Conversion issue between at least html5/iOS

Monkey Forums/Monkey Programming/Conversion issue between at least html5/iOS

frank(Posted 2013) [#1]
This probably has been handled here more but I couldn't find it via search:

Local i:Float := 1.0

Print "Hello "+i

HTML5 target prints;

Hello 1

while iOS says:

Hello 1.0

This is usually not an issue, but for some things, a very annoying difference... Is that intentional?


AdamRedwoods(Posted 2013) [#2]
Is that intentional?

in html5, every number is treated as float, so i think internally the js interpreter converts floats to drop the decimal place if it's a whole number.


frank(Posted 2013) [#3]
Yes, I know, but for a language which is meant to show the same behavior on multiple platforms, I think the type casting before String concat should fix this, not let it depend on the native platform implementation. If you know it, it's fine, but if you don't, you can be creating 100k LOC in html5, then decide to recompile for iOS (wow works!), run it and get a Monkey Exception without having a clue what is going on ...