-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Mages core produce incorrect output #110
Comments
The number is too long and cannot be stored in 64-bit integer. The solution would be to only use 64-bit integer for "smaller" numbers and accept the loss of accuracy beyond (going to doubles). Going immediately to doubles would not be a good idea. Happy to accept PRs on this one. Lines in question are 113 an 181 (https://github.com/FlorianRappl/Mages/blob/devel/src/Mages.Core/Tokens/NumberTokenizer.cs#L113). |
@dakersnar |
@FlorianRappl |
Yes that could be another option. I'd need to see what the perf impact is either way. |
FYI, .net 7 may come with |
It might be good to prevent parsing nunber ls that will be to large and throw an exception in that case. |
We don't throw errors - as we don't compile this might be a runtime error and is therefore very destructive. We could just set the value to NaN in such cases.
Yeah I don't think taking more fixed bytes solves the problem. Then the number from OP works, but some user will always come up with a larger input / number. As we anyway use doubles internally we can safely transition to losing precision after the 64-bit range is exceeded. |
I thought on something like |
Other scripting languages such as JavaScript also don't throw errors in these situations. They just lose precision. Throwing a parse exception is rather destructive and only makes sense if the parsed content cannot be understood. This is not the case here. The parser understands it - it's just that the desired precision does not match the computing abilities. |
Fixed (in 2.0.1) with digit shifting after perf. evaluation. Original:
BigInteger:
Digit Shifting:
|
How are these tables meant? Wath does this numbers mean? When will v2.0.1 be available? |
Just time to run certain perf. tests that we have. Since you are not familiar with the code / project they should not matter much to you. Lower (i.e., shorter time) is faster.
Today. |
There is a bug in mages that results in incorrect output. Even if there is nothing to calculat. It happens with decimal and int numbers.
The following is happening:
Originally posted by @htcfreek in microsoft/PowerToys#18574 (comment)
The text was updated successfully, but these errors were encountered: