Can this support hex integer expression, like `0xaa` ?
Closed this issue · 2 comments
Himmelt commented
I need to eval an expression like this: 0x600+8
, it's expected to be 0x608
,equals 1544
.
Can this project currently achieve this function? If not, can you please implement it ?
miroiu commented
Hi, this syntax is not supported for numbers. But if that's not a hard requirement, you can create a custom math context and implement all the operators you need to work with numbers in base 16. And a custom Eval
extension method that knows how to convert back to base 10.
Example: var result = "600+8".Eval(base16Context); // 1544
See the boolean math example PR.
miroiu commented
I don't plan to support parsing hexadecimal numbers anytime soon. Please reopen the issue if you need more information.