Note that this is in the documentation for these functions: help?> % search: % .%
rem(x, y) %(x, y) Remainder from Euclidean division, returning a value of the same sign as x, and smaller in magnitude than y. This value is always exact. x == div(x,y)*y + rem(x,y) help?> mod search: mod modf mod1 module mod2pi Module module_name module_parent chmod invmod mod(x, y) Modulus after flooring division, returning in the range [0,y), if y is positive, or (y,0] if y is negative. x == fld(x,y)*y + mod(x,y) On Fri, Dec 25, 2015 at 12:32 PM, Stefan Karpinski <[email protected]> wrote: > The % operator is shorthand rem, which computes the remainder; the sign of > the result matches the first argument. The mod function also exists, which > computes the modulus, the result of which matches its second argument. > > On Fri, Dec 25, 2015 at 12:19 PM, Pranit Bauva <[email protected]> > wrote: > >> Hey everyone! >> >> Julia's way of handling negative values in % seem to be different. >> julia> 7 % -3 >> 1 >> >> julia> -7 % 3 >> -1 >> >> julia> -7 % -3 >> -1 >> >> julia> >> >> >> Is this a bug or a feature? >> >> Regards, >> Pranit Bauva >> > >
