Closed rudyhuyn closed 5 years ago
This is your friendly Microsoft Issue Bot. I've seen this issue come in and have gone to tell a human about it.
Despite not having an exp button, I don't think we should be blocking folks unnecessarily from pasting in a valid number, so I think we should support pasting these values in both standard mode and in most converters.
Currency converter is an odd one, though, since that is not a domain where scientific notation is typically used. Are there other converters where scientific notation might not be appropriate?
I agree, we should not block users. I will fix ExpressionRegExMatch
to allow these numbers asap.
For converters, I agree, I think we should allow it. I would probably never use scientific notation with the currency converter, but if someone wants to use this notation (💰), it's probably better to allow it and not treat this converter differently.
I ran some tests to assess the workload necessary to support:
Standard mode:
StandardCalculatorViewModel
+ CalculatorManager
already support this type of numbers, we simply need to modify some regular expressions in CopyPasteManager::ExpressionRegExMatch
to support these numbers.
Unit Converter
UnitConverterViewModel
and UnitConverter
don't support scientific notations. If we want to do it we need:
UnitConversionManager::Command::Exp
UnitConverter::SendCommand
to support exponent.UnitConverterViewModel
sends the command Exp
(when users paste 12e21
for example, for a few nano seconds (because commands are sent 1 by 1 (probably something we need to change too)) the number will incorrect (12e
) and crashing the application. We need to add some logic to ignore this temporary state.UnitConverter
to correctly support backspace with scientific notation.
44e+11
-> 44e+1
-> 44e+0
-> 44
, the current implementation is very basic and doesn't support this scenario.@grochocki if you are ok with that, I would recommend to fix the issue for the standard mode and create another task for converters if we really want to do it.
Let's fix the issue for standard mode, but leave converters for now. I have not seen any feedback about scientific notation support in converters, so we can revisit later, if necessary.
Describe the bug
It is not clear if the calculator should allow users to paste expressions with scientific notations (E notation, for example 12e+10) when the calculator is in Standard mode.
Some unit tests and methods show that we should support it: https://github.com/microsoft/calculator/blob/41e2e975918c6838947e29a046778bd4d57feeee/src/CalculatorUnitTests/CopyPasteManagerTest.cpp#L133
https://github.com/microsoft/calculator/blob/41e2e975918c6838947e29a046778bd4d57feeee/src/CalcViewModel/Common/CopyPasteManager.cpp#L197
while other methods like
CopyPasteManager::ExpressionRegExMatch
don't accept them when the calculator is in Standard mode, making it impossible to paste a number in scientific notation.Why we should allow it
999999999999*999999999999
, so we should probably allow users to copy the result and paste it later.Why we should not allow it
exp
button, meaning the only way to enter a number in scientific mode will be via copy/paste (and via the history).Steps To Reproduce
12e+10
Expected behavior
Currently unknown
Device and Application Information**
Requested Assignment
If possible, I would like to fix this.
Bonus
If we allow users to do it, we should also decide if we want to allow them to copy these type of numbers with unit converters.