Incorrect value for mod(uint32(5), 2)

Gregery T Buzzard greg.buzzard at gmail.com
Thu Jul 3 05:04:47 CDT 2008


Due to the fact that uint32(5)/2 gives 3 for compatibility for matlab
and the use of division in the mod.m file, mod(uint32(5),2) gives 0
when it should give 1.

A simple patch is to replace

x - y .* floor (x ./ y);

with

x - y .* floor (double(x) ./ y);

at lines 57 and 70 in mod.m (version 3.0.1).

Greg Buzzard


More information about the Bug-octave mailing list