gnosygnu / xowa

xowa offline wiki application
Other
379 stars 40 forks source link

#eval - treat dot as a number #838

Open desb42 opened 3 years ago

desb42 commented 3 years ago

Looking at en.wikipedia.org/wiki/2019_FIVB_Volleyball_Women%27s_Challenger_Cup#Pool_A shows eval1

the wikitext for that table is

{{Vb cl9 team |p=1 |t={{vbw|CZE}} |w3_0=0 |w3_1=2 |w3_2=0 |l2_3=0 |l1_3=0 |l0_3=0 |spw=194 |spl=160 |bc=#ccffcc}}
{{Vb cl9 team |p=2 |t={{vbw|CRO}} |w3_0=0 |w3_1=1 |w3_2=0 |l2_3=0 |l1_3=1 |l0_3=0 |spw=168 |spl=189 |bc=#ccffcc}}
{{Vb cl9 team |p=3 |t={{vbw|PER}} |w3_0=0 |w3_1=0 |w3_2=0 |l2_3=0 |l1_3=2 |l0_3= |spw=186 |spl=199}}
--------------------------------------------------------------------------------^

as indicated, on the last line the parameter l0_3 is blank (the others have 0 (zero))

the template Vb cl9 team makes use of many #evals an example is

{{#expr: {{{l0_3|}}}. + {{{l1_3|}}}. + {{{l2_3|}}}. }}

in my example with substitution

{{#expr: . + 2. + 0. }}

This currently does not give the correct answer

I believe that the issue can be tracked down to 100_core\src\gplx\Decimal_adp_.java function parse Essentially a single dot is not parsed correctly

A suggested fix is to check for the string starting with a dot and adding a zero(0)

please see Decimaladp.zip

gnosygnu commented 3 years ago

Wow! Good breakdown and nice drilldown from error to cause.

Fixed with commit above. Thanks as always!