弹性模量_模量

弹性模量

弹性模量

Just a thought on the exam prep question 1.

只是对考试准备问题1的思考。

The question in its essence is "How much is 3 - 5 % 3"; The answer is 1 because 5 % 3 is 2 and 3 - 2 is 1.

本质上的问题是“ 3-5%3多少钱”; 答案是1,因为5%3是2,而3-2是1。

That's exactly what the book says but in the explanation of the correct answer there's a mistake saying that 5%2 is 2 when it should be 1.

这正是书中所说的,但是在对正确答案的解释中,有一个错误说5%2是2,而应该是1。

So just a quickie - how the modulus thing works? Well, it's starts with a division and then gives the reminder of the division that would give a whole number. In other words:

因此,只是一个快捷方式-模数是如何工作的? 好吧,它从一个除法开始,然后提醒该除法将给出一个整数。 换一种说法:

  • 5 % 3 is like 5 - 3 because 3 / 3 will give the whole number 1.

    5%3就像5-3,因为3/3将得到整数1。
  • 5 % 2 is 5 - 4 because 4 /2 will give the whole number 2

    5%2是5-4,因为4/2将得出整数2
  • 5 % 4 is 1 because 4/4 is a whole number and 5-4 is 1

    5%4是1,因为4/4是整数,而5-4是1
  • 5 % 5 and 5 % 1 both give a nice round 0, because 5/5 gives the whole number 1 and there is no reminder. The same way 5 / 1 gives the whole number 5 and there is no reminder.

    5%5和5%1都给出一个不错的回合0,因为5/5给出了整数1,并且没有提醒。 同样的方法5/1给出整数5,并且没有提醒。

The important thing the guide mentions is that the modulus operation in php can give negative results unlike the modulus in the math. The result will be negative only if the first number is negative. I.e. 5 % (-2) = 1 while -5 % 2 = -1

该指南提到的重要一点是,与数学中的模数不同,php中的模数运算可以给出负结果。 仅当第一个数字为负数时,结果才为负数。 即5 % (-2) = 1-5 % 2 = -1

Tell your friends about this post on Facebook and Twitter

FacebookTwitter上告诉您的朋友有关此帖子的信息

翻译自: https://www.phpied.com/modulus/

弹性模量

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值