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
Value was either too large or too small for a UInt16. #41
Comments
Adding my +1 to this. Needed it to perform operations on 32-bit layermask values... not sure why the decision to limit the bitwise operands to 16 bits |
Hello, sorry for my late reply. Not sure why binary operators use 16-bit numbers, most likely due to historical reasons. If you adapt the code to support 64-bit integers (or 128-bit decimals), please submit a PR. Thanks. |
@yallie I'm interested in adding support for this. I plan on supporting up to 64 bit integers since dotnet doesn't support binary operators on Would it be best to add an option to |
@gmcchessney, great, please go ahead :)
I'd say it's better to implement support for integers of any size. |
Excited to see this! |
The perfect being the enemy of the good, why not do the extremely simple change of UInt16 to UInt32 for the bitwise operations? 2 minute change to the code, and solves a longstanding problem. Handling larger integers isn't something anyone has requested, after all. And if there are any backward compatibility issues, I can't see them (I guess if you were counting on an Exception, that could be a problem). An option for Allow32BitIntegersInBitwiseOperations doesn't strike me as necessary, but if that's the way to get this implemented, I'm all for it! :) |
I'm trying to do binary operators ^ | on integer values representing flags to only keep the desired values. My values are actually 64bits (ulong), but NCalc seems to do all its internal numeric computation on 16bits. Any way around that?
The text was updated successfully, but these errors were encountered: