ProgerXP / Notepad2e

Word highlighting, simultaneous editing, split views, math evaluation, un/grep, comment reformatting, UAC elevation, complete regexps (PCRE), Lua lexers, DPI awareness and more (XP+)
Other
370 stars 52 forks source link

Math Eval - allow sign in shorthand sum expression #437

Open ProgerXP opened 1 year ago

ProgerXP commented 1 year ago

Special case: expression with only digits (including hex), radix prefix/suffixes, periods and any ignored symbols (above) is treated as a series of whitespace-separated numbers, which are summed up.

Extend this rule by allowing sign before every valid number:

12,3 -45.6 $78 -10h = 123-45.6+78-16 = 139.40

Update: but 123 -456 could be either a shorthand expression (123 + -456) or a full expression with lacking whitespace (123 - 456). More thought should be put into this feature.