News for hackers. Stuff that matters.
Re:Mod and remainder are not the same by AnIdiotOnTheNet on Thursday August 23, 2018 @08:09AM (#17826512)
For this reason, Zig requires the programmer to specify which is intended when the operator is used on signed integers:

  var x: i32 = -17 % 12; //compile error: remainder division with '(integer literal)' and '(integer literal)': signed integers and floats must use @rem or @mod
  var y: i32 = @mod(-17, 12); //7
  var z: i32 = @rem(-17, 12); //-5

There are no comments on this comment yet.