From help-octave-request at bevo dot che dot wisc dot edu Fri Nov 21 16:18:12 1997 Subject: rem From: "John W. Eaton" To: "Charles E. Suprin" Cc: help-octave at bevo dot che dot wisc dot edu Date: Fri, 21 Nov 1997 16:19:01 -0600 On 19-Nov-1997, Charles E. Suprin wrote: | This is a simple question. rem in octave claims to not do imaginary | numbers. It commnets that the matlab one is a bunch of hooey. | However the complex nature is used in the unwrap function. Has anyone | implemented a matlab compatible rem function. What is rem supposed to do for complex numbers? Can someone point me to a textbook definition? Matlab 4.2 provides what I think are some strange results: >> rem (1,i) ans = NaN >> rem (i, 1) ans = 0 >> rem (i, 2) ans = 0 >> rem (55+37i, 3+4i) ans = 1 Note that these results are not the same as x - fix(x./y).*y (what the help text suggests is used for computing rem(x,y) and which I don't think would be correct for complex numbers anyway). Instead, it appears that Matlab's rem function is discarding the imaginary parts of its arguments. If that's the result you want, why not simply code it explicitly? Thanks, jwe