Numeric constants with negative exponents, long constants, and precise operands are mishandled
closedOpened by MelanX on
Original description
By MelanX · October 23, 2026Crate: tools/minecraft-options
Commit: 2b2af1e4f8166d02e4732d19e040a53745d97a51
Behavior
M_FLOATuses the character class[\d.eE+], which has no-, sofloat 1.0E-5fanddouble 1.0E-4d(javap switches to scientific notation below 1e-3) never match. NaN and Infinity do not match either.const_numreturnsNoneandarithmetic_chainsilently drops the operand, giving a wrong transform with no error. For an encode/decode pair both directions lose the same step, so theinvert_opsequality check still accepts it.const_intandconst_numnever readldc2_wlongs orlconst_*.formula()renders operands with:g(six significant digits), so0.33333334becomes0.333333and1234567becomes1.23457e+06. The dataset regexes accept the truncated value.
Expected behavior
Constants are parsed completely and rendered with their exact value (repr), and an operand that cannot be parsed makes the transform unresolved.
Impact
No current release triggers it (the cache holds only the operations -70 and /40), but a future transform could be shipped with a changed scale and high confidence.
Locations
tools/minecraft-options/analyze_options.pyM_FLOAT(245),const_int/const_num(330-362),formula(380-388)tools/minecraft-options/dataset.py_AFFINE/_OFFSET(69-70)
Validation and limitations
M_FLOAT.match("float 1.0E-5f") is None; formula produced (x * 0.333333) and (x - 123.457) in scratch runs.