Closed yuval-herman closed 6 months ago
In general you are right, but "signed or floating-point operands must be comptime-known and positive." That's what prompted me to choose this example. However, I agree that this should be mentioned in the description. Not to confuse anyone. In general, it has become quite difficult to find simple examples for the use of C, as this is no longer necessary with Zig. Because even for this example I can also use Zig @mod(a, b)
. Perhaps you have an idea.
Explanation revised: https://codeberg.org/ziglings/exercises/pulls/53
While going over the exercise I saw the line:
However as I tested to see if it's true, running the following code:
Produces
1.5
as expected. I also searched for mentions of the modulo operator working on integers only in the official zig repo but found nothing related. Either I am missing something or this might be outdated.