Closed Ashvith10 closed 1 month ago
I did not look into the code, but it seems as if x%y
is interpreted as (x/100)+y
and not as modulo. For modulo one would need x mod y
.
Note that we are using fend for evaluating everything in the calculator.
Yea it seems that fend always treats %
as a unit. They have an open issue to also support it as a module operator, but it seems that it might not be trivial to implement in their parser (https://github.com/printfn/fend/issues/265).
I kinda want to label this as a bug as I agree this is not what the user expects. I don't know exactly how we should fix it though. I think we could either (in order of ascending difficulty and flexibility):
([\d]+) *% *([\d]+)
with $1 mod $2
.Hello, fend maintainer here! I've implemented a fix for this in v1.4.8.
Awesome! Thanks for the heads up
When I try calculating
100 % 12
, I get13
as the answer.