Re: text.e bugs?
- Posted by cargoan Jan 09, 2015
- 2521 views
Eu4.1 on Archlinux64
field size = 12
[$]: eui prutext.ex 1 Printf: 32.00 Fmt A: 32.00 Fmt B: 32.00 Raw: 32 2 Printf: 1.20 Fmt A: 1.20 Fmt B: 1.20 Raw: 1.2 3 Printf: 1.23 Fmt A: 1.23 Fmt B: 1.23 Raw: 1.23 4 Printf: -1.23 Fmt A: (1.23) Fmt B: -1.23 Raw: -1.23 5 Printf: -45.60 Fmt A: (45.60) Fmt B: -45.60 Raw: -45.6 6 Printf: -45.61 Fmt A: (45.61) Fmt B: -45.61 Raw: -45.61 7 Printf: 1499.46 Fmt A: 1,499.45 Fmt B: 1,499.45 Raw: 1499.459 8 Printf: -267.46 Fmt A: (267.45) Fmt B: -,267.45 Raw: -267.456 9 Printf: 1234567.89 Fmt A: 1,234,567.89 Fmt B: 1,234,567.89 Raw: 1234567.893 10 Printf: -1234567.89 Fmt A: ,234,567.89) Fmt B: 1,234,567.89 Raw: -1234567.894
field size = 14
[$]: eui prutext.ex 1 Printf: 32.00 Fmt A: 32.00 Fmt B: 32.00 Raw: 32 2 Printf: 1.20 Fmt A: 1.20 Fmt B: 1.20 Raw: 1.2 3 Printf: 1.23 Fmt A: 1.23 Fmt B: 1.23 Raw: 1.23 4 Printf: -1.23 Fmt A: (1.23) Fmt B: -1.23 Raw: -1.23 5 Printf: -45.60 Fmt A: (45.60) Fmt B: -45.60 Raw: -45.6 6 Printf: -45.61 Fmt A: (45.61) Fmt B: -45.61 Raw: -45.61 7 Printf: 1499.46 Fmt A: 1,499.45 Fmt B: 1,499.45 Raw: 1499.459 8 Printf: -267.46 Fmt A: (267.45) Fmt B: -,267.45 Raw: -267.456 9 Printf: 1234567.89 Fmt A: 1,234,567.89 Fmt B: 1,234,567.89 Raw: 1234567.893 10 Printf: -1234567.89 Fmt A: (1,234,567.89) Fmt B: -1,234,567.89 Raw: -1234567.894in format function (std/text.e, line approx. 1870)
if atom(currargv) then if find('e', argtext) = 0 then -- Only applies to non-scientific notation. if decs != -1 then pos = find('.', argtext) if pos then if decs = 0 then argtext = argtext [1 .. pos-1 ] else -- added -------------------------------------------------------------------------------- integer pflag = 0 -- parenthesis flag if msign and currargv < 0 then pflag = 1 -- argtext = "(dd...d.dd...)" end if -- -------------------------------------------------------------------------------------- -- -- pos = length(argtext) - pos pos = length(argtext) - pos - pflag -- without closing parenthesis if pos > decs then argtext = argtext[ 1 .. $ - pos + decs ] elsif pos < decs then -- -- argtext = argtext & repeat('0', decs - pos) argtext = argtext[ 1 .. $ - pflag ] & repeat('0', decs - pos) -- except closing parenthesis -- added -------------------------------------------------------------------------------- if pflag then argtext &= ')' -- add closing parenthesis end if -- -------------------------------------------------------------------------------------- end if end if elsif decs > 0 then argtext = argtext & '.' & repeat('0', decs) end if end if end if end if