- Joined
- Aug 1, 2023
- Messages
- 52
'real' literals are sometimes parsed incorrectly:
The values of 'xs[8]' and 'xs[9]' are very strange. @LeP, it would be nice if pjass could detect and warn about these "bad" literals.
I ran into this with '1.0f / 30.0f' getting translated to '0.0333333333' in cjc.
JASS:
function testJassRealLiteralParsing takes nothing returns nothing
local integer a
local real array xs
set xs[0] = 0.03 // 0.030000000
set xs[1] = 0.033 // 0.032999998
set xs[2] = 0.0333 // 0.033300000
set xs[3] = 0.03333 // 0.033330004
set xs[4] = 0.033333 // 0.033333002
set xs[5] = 0.0333333 // 0.033333300
set xs[6] = 0.03333333 // 0.033333330
set xs[7] = 0.033333333 // 0.033333330
set xs[8] = 0.0333333333 // 0.236395648
set xs[9] = 0.03333333333 // -0.790978688
set a = 0 - 1
loop
set a = a + 1
exitwhen 10 == a
call BJDebugMsg(R2SW(xs[a], 1, 9))
endloop
endfunction
The values of 'xs[8]' and 'xs[9]' are very strange. @LeP, it would be nice if pjass could detect and warn about these "bad" literals.
I ran into this with '1.0f / 30.0f' getting translated to '0.0333333333' in cjc.