New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve clarity of math expressions in history for Standard Calculator #138
Comments
@g-plane standard mode calculates immediately before the next operator is armed, just like a "dumb tabletop calculator". I do agree the expression in the calc history is confusing. |
Is this an expected behavior? |
not on the relevant team but I believe so. :) The history page could use the following improvement:
|
I agree that this is the wrong behaviour, but I also guess that this is intentionally for folks who are used to those 'financial' (aka. cheap crap) calculators. |
I think this was an intentional behavior, similar behavior to that of a cheap calculator. |
Thanks for the report! I really appreciate your thoroughness when filing this bug.
Yes, this is by design. Standard Calculator mode works in immediate-execution mode, just as a simple pocket calculator would. It ignores order of operations entirely. The solution today would be to use Scientific Calculator, though we have discussed this on the team in the past and agree we can do better at making this distinction clearer. @yatli I think you are onto something with your suggested improvement to address the confusion with this. I am going to close this bug as by design for now, but we welcome suggestions on how to improve this experience. Take a look at the pitch tempalte in our New Feature Process to get started. |
@grochocki There was already a suggestion made by @yatli and I agree with it. Should there be a new "issue" about it or should this one be edited? |
If your app ever prints "5+5*5=50", then that is a bug. The app is giving incorrect results. At the very least you need to print that out with parenthesis so that what you're saying is correct. Closing this as by design is ridiculous. You may have intended for it to behave this way, but that doesn't make it okay. The fix is simple (or I should say, it should be simple - I must confess I find this code base hopelessly hard to navigate/understand and couldn't figure out how to make this simple change in a reasonable period of time). Just like the physical calculator whose behavior you're trying to emulate: simply insert an implicit "Enter" key after each binary operator. That way after each operator, the result is evaluated and put in the "ans" slot, so that it can be used for the next operation. This makes it explicit that each binary operator is "eagerly" evaluated (rather than the current behavior, where you make it appear as if you're building up the whole expression, and then just going off and evaluating it incorrectly.. but also not giving any indication that this is what you did). You can simulate this manually in the calculator and it works fine. For example, the 5+5*5 example would be 5+5 Crystal clear what's going on, works just like old physical calculators (and prints results similarly to them), and no more "5+5*5=50" incorrect output. EDIT: I see that this is exactly what @yatli suggested. |
As @ssylvan mentioned, I hope this issue can be reopened. |
@g-plane / @yatli / @Fabian42 / @ssylvan Feel free to reactivate this issue and update the top comment based on guidance outlined in our new feature process. |
I don't think I can reactivate the issue (at least I don't see an option to do so), but I'll reiterate: if you are printing incorrect results, then that is a bug. Fixing bugs is not "a feature". There may be many ways of fixing this bug (e.g. either print with parenthesis or evaluate after each operator), but that doesn't change the fact that a calculator that explicitly tells its users that 5+5*5=50 is buggy. |
This issue was closed by @grochocki not by me, so I'm not able to reopen. |
Oops--reopening so we can evolve the idea. |
We can also not edit reports, only the reporter can (and maybe the
repository owner or something like that?).
…On Fri, 8 Mar 2019, 09:59 Dave Grochocki, ***@***.***> wrote:
Reopened #138 <#138>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#138 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AJ_vYqwIbneRg7YeNSPosE9y37i6xsfzks5vUiaHgaJpZM4biQjp>
.
|
This is your friendly Microsoft Issue Bot. I've seen this issue come in and have gone to tell a human about it. |
I worked last night on a Diff to add parenthesis to the History panel when using the Standard mode, but if it clears the confusion, in fact, it makes the history harder to read when we display:
So I trashed my diff, and thought about a new way: display keys instead of operators: I think it helps a lot and clears the confusion. It's a big refactoring, so before I start working on it, what do you think about this idea? |
Parenthesis should be added when needed. |
Honestly I think the best thing to fix this is to make it work like those physical calculator (which appears to be the intent for the standard mode). I.e. add a line in the history for each operation (and its result), just like you would get on the "paper roll" on the old physical ones. Makes it very clear that the next operator takes the previous result as an input. |
Parentheses when needed seem to me like a good compromise between readability and correctness:
|
Yeah.. The only danger with parenthesis is that it could get very "lispy" if you do a lot of precedence changes back and forth. But it would fix the actual bug (which is that the calculator prints things that are mathematically untrue) and maybe someone can work on a nicer presentation or whatever later to make it clear er why that's the order that was used. |
Had a quick back-and-forth with @JeGentle on Twitter about this. Maybe a simple color change could help make this more visually obvious without affecting the behavior of the calculator at all, and without overcomplicating things. Here's a simple mock-up. |
That highlights "220 x 0.5", which is exactly what did not happen. This reply sounds more reasonable: https://twitter.com/BrandonLive/status/1281604102632296455 |
It's actually a complex and subtle UX problem, and like I said on the Twitter thread, it would take some experimentation. It's really easy to go down a rabbit hole of overdesigning a solution to this problem. Yes, your proposed solution makes sense when there are just two terms—and yes, everyone who's seen this problem thought of it, too 😉—but it's problematic. Adding intermediate results, animations, etc., works fine with three terms (230 − 220 × 0.5), but the meaning gets really muddled when once you have a string of terms. I attached an updated mockup (which now uses × and ÷ instead of x and / since you asked) that shows a longer expression. Try adding intermediate results between all of the terms and it quickly devolves into a visual mess. Adding intermediate terms to the calculation log contorts its meaning, changing it from "this is a record of what you typed" to "this is what the calculator is thinking," which really gets away from the original intention of the standard mode. That's why I like visually fading all but the last two terms: it highlights that the last two terms are important without altering the semantics of the UI. In effect, it says, "These two terms are the important ones," without changing the overall meaning of that part of the interface. And it keeps the last two terms un-faded as you type in more terms, which reinforces the idea that those are the important part of the expression. It's still not an awesome solution, and I'm sure it can be improved on, but I think it's a step in the right direction. |
That's a really interesting idea! It keeps the semantics intact while still being arithmetically correct. Nice! |
Excuse me, is it possible to change the name of this mode now before making decisions on other parts? IMHO, the name “Standard Calculator” is a major cause of confusion, and “Immediate Calculator” proposed by @tngreene sounds like a nice choice. In the context of calculation, “standard” refers to mathematical principles by default. However, what “Standard Calculator” shows is not math expression but type record, that's, “Standard Calculator” is not a standard calculator. “Immediate” indicates its nature: Every time you perform an operation, it is effectively a soft =, and you get the result of what you just typed immediately. Even if users can't understand “immediate”, they will pay much more attention when using this mode. Besides, translating “immediate” is easy to my knowledge. |
I'm afraid it's technically not possible, which involves typography, layout and localization at least. Users may type something complexFor example, how to represent 123456789+1000000000000000√x²1/x-123456789 Meanwhile, don't forget that the width of the History Panel is approximately only 320 epx now. Or if it becomes flexible, given that the width of a UWP app window usually varies from hundreds to thousands of epx, how do you handle it? Such a view is a tough graphical problemThe design you proposed is a kind of pretty math typesetting which is known to be difficult even in mature LaTeX compiler. Then, how to implement it with UWP XAML controls? Off the top of my head: Since we cannot know what a user will type within a sequence, we have to regenerate the History Panel entirely (not just update a few elements), which might be a potential performance problem. If the History view is a plaintext area, it's a common case that rendering engine surprises you, and even monospaced font is not monospaced, especially when there are multiple scripts. We eventually need to learn from Windows Terminal which succeeds in making all the glyph widths fixed. If the History view is constructed with pure UWP controls, perhaps it's a grid view. And Character Map UWP tells us that large grid impacts performance significantly on low-end devices. Maybe other ways ... Finally, the task becomes as complex as developing a big video game. The world doesn't use a unified systemIf I recall correctly, Arabic people prefer a special math notation system in pretty math typesetting. We have to consult experts to make every detail correct. |
Over a year later, this is still an issue. I also discovered this issue when I noticed Windows was giving misleading answers to my calculations. The way it displays the calculation, it misleads users into thinking it calculates with order of operations. I now mainly use Scientific Mode since it does not have this issue. Sidenote: I'm not sure that there really is a need for a calculator that performs operations one at a time (generally it is used with only 1 operator repeatedly and when it's not, you can use parenthesis or use the result in a separate calculation). Almost all calculator applications on any OS use order of operations. Assuming Windows is to keep this method of calculation for Standard mode, here is my suggestion for a less misleading UI: The operators can be aligned with the number they are operating on instead of being centered. That way, the user can read it as (((2*3)+2)*5) without the need for cluttering the UI with parenthesis. By grouping the operator and number together, it makes it seem like it is a single operation and they are done one at a time. |
Hey everyone, Expanded on @joseartrivera spec. Let me know what you think! Feature Pitch Link: microsoft/calculator-specs#27 |
…r (feature #138) (#1453) * Implemented feature & added unit tests * Fixed more unit/ui tests * Refactored tests * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp
Describe the bug
Operators precedence in standard mode seems wrong, but works correctly in scientific mode.
Steps To Reproduce
75*0.3 + 60*0.7
)Expected behavior
75*0.3 + 60*0.7
should be64.5
. However, the calculator will show the wrong result in standard mode.Screenshots
Standard mode:
Scientific mode:
Device and Application Information (please complete the following information):
Possible solution (additional)
According to the disscusion of this issue, the calculation is expected. The bug is of the "History Panel". Some folks advised to add parens for expressions to be not confusing.
The text was updated successfully, but these errors were encountered: