声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 4170|回复: 2

[求助]rem和mod有什么区别,谢谢各位大虾

[复制链接]
发表于 2006-6-4 16:32 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
谢谢谢谢<br>我知道二者有区别,但是到底区别在哪却不大清楚。<br>哪位大虾可以给小弟解释一下,感激不尽
[此贴子已经被cdwxg于2006-6-4 17:18:18编辑过]

回复
分享到:

使用道具 举报

发表于 2006-6-4 17:17 | 显示全部楼层
<P><FONT color=#ff0000>R = rem(X,Y)</FONT> if Y ~= 0, returns X - n.*Y where n = fix(X./Y). If Y is not an integer and the quotient X./Y is within roundoff error of an integer, then n is that integer. By convention, <FONT color=#0000ff>rem(X,0) is NaN</FONT>. The inputs X and Y must be real arrays of the same size, or real scalars<br><br><FONT color=#ff0000>M = mod(X,Y)</FONT> if Y ~= 0, returns X - n.*Y where n = floor(X./Y) . If Y is not an integer and the quotient X./Y is within roundoff error of an integer, then n is that integer. By convention, <FONT color=#0000ff>mod(X,0) is X.</FONT> The inputs X and Y must be real arrays of the same size, or real scalars<br><br><br><FONT color=#ff0000>So long as operands X and Y are of the same sign, the statement rem(X,Y) returns the same result as does mod(X,Y). <br></FONT><FONT color=#0000ff>However, for positive X and Y, rem(-X,Y) = mod(-X,Y)-Y<br>也就是说除了特定的几个用途外,只有正负时候的转化有区别。<br></FONT></P>
<P>The <FONT color=#ff0000>rem</FONT> function returns a result that is between 0 and sign(X)*abs(Y). If Y is zero, rem returns NaN.<br>The <FONT color=#ff0000>mod</FONT> function is useful for congruence relationships: x and y are congruent (mod m) if and only if mod(x,m) == mod(y,m).<br>对于平常用的常数类或者常数矩阵基本没有区别。</P>
[此贴子已经被作者于2006-6-4 17:26:02编辑过]

 楼主| 发表于 2006-6-4 17:55 | 显示全部楼层
谢谢哈
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-25 11:18 , Processed in 0.068223 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表