From octave-sources-request at bevo dot che dot wisc dot edu Fri Jul 28 23:49:47 2000 Subject: Re: matlab-like functions From: Edward Jason Riedy To: pkienzle at kienzle dot powernet dot co dot uk cc: octave-sources at bevo dot che dot wisc dot edu, tpikonen@pcu.helsinki.fi Date: Fri, 28 Jul 2000 21:49:41 -0700 And Paul Kienzle writes: - Slightly worse I would say. Mod(x,0) is NaN even if matlab says - otherwise. Saw this while checking the archives for a bug in x{max,min} (patch on the way after testing)... By IEEE, rem(x, 0) is NaN. Matlab agrees, although only giving it the weight of `convention.' Matlab's `convention' for mod(x, 0) is 0. The convention comes from integer arithmetic, I believe. Consider the definition of the mod n operator as a map from the integers to Z_n = { 0, 1, ... , n-1 }. Then it makes complete sense for x mod 0 to be 0, as Z_0 = { 0 }. I can't cite a source for this at the moment, but it seems sensible. I think Matlab is trying to give integer people more-or-less what they expect, at least until the integers become too large. Perhaps someone with a copy of Concrete Mathematics could see if the topic is discussed. Graham, et al. like to confront these issues. Jason ----------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.che.wisc.edu/octave/octave.html How to fund new projects: http://www.che.wisc.edu/octave/funding.html Subscription information: http://www.che.wisc.edu/octave/archive.html -----------------------------------------------------------------------