Skip to content

Conversation

friday
Copy link
Member

@friday friday commented Apr 17, 2022

These fixes are meant to help for #1009

  1. Fix bad fallback in eval_expr(). When eval_expr() failed it tried again, but stripped the last character. This would help to show for example "6" as the result when typing "6 *", until you type a second number. But the fallback was wasteful and applied too wide. I replaced it with a much more specific regex replace that strips the last operator (including ** which is one operator, but not ++ which is two)
  2. I also added parenthesis completion for unfinished queries while I was at it.
  3. Added memoization to avoid running the same evaluation repeatedly (should work especially well with the normalization)
  4. Round the result to at most 15 decimals (as in Extend calculator functionality #1009, but applied consistently and doesn't zero-pad results)

@friday friday merged commit e09be45 into v6 Apr 17, 2022
@friday friday deleted the v6-calc-improvements branch April 17, 2022 07:37
@friday friday added this to the 6.0.0 milestone Apr 17, 2022
@friday friday mentioned this pull request Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant