69,382
社区成员
发帖
与我相关
我的任务
分享
sub test()
MsgBox 3/2
end sub
sub test()
MsgBox 3/2
end sub
[/quote]
好吧,vba是vb的子集。它继承了vb的/运算,它是浮点运算!但是也要清楚一点vb还有\这个东东滴。它只是把整除和除的概念直接分离来了!也就是说它绕开了类型转换的一些弊端!
言归正传!咱们说的是c语言!它并没有像VB那样做!我依旧坚持我的观点!
5 The result of the
/
operator is the quotient from the division of the first operand by the second; the result of the% operator is the remainder. In both operations, if the value of the second operand is zero, the behavior is undefined.
6 When integers are divided, the result of the
/
operator is the algebraic quotient with any
fractional part discarded.
88)
If the quotient
a/b
is representable, the expression
(a/b)*b + a%b
shall equal
a
C99说了,整数相除,丢弃任何小数
float(3)/float(2)
我不是怀疑,而是真的想知道究竟有没有这个相对于你的“一般”中的特许情况的,如果有,什么时候出现?谢谢!!![/quote]
3/2 = 1
3/2.0 = 1.5