在运算符 ➡ 算数运算符 ➡ 操作符 ➡ // 整除(地板除) 3//4

为什么叫地板除?

向下取整除,就是地板除 floor division

向上取整除,就是天花板除,ceil division


1.地板除“floor division”的根源追溯:

在Lear Python APP中

1.“//” 操作符:

这个符号跟“+”、“-”一样,都叫做“操作符”(Operator)。

这个操作符由两个向右的斜线(forward slash)组成,对应英文是 “floor division”。

2.英文解释:

If you imagine a room where 3 is on the ceiling and 2 is on the floor. 2.5 would fit in the middle. Floor division means the "//" will always take the floor or the lower number.

假想一个房间,数字“3”在屋顶上,数字“2”在地板上,数字“2.5”处于中间。“floor division”的意思是:“//”这个运算符会得到地板上的数字或者较小的那个数字。

如图:地板除和天花板除

根源于:

数学家高斯在1808年为“floor 函数”引入了[x]这个记号。1962年计算机科学家肯尼斯·艾佛森在他的书中引入了“floor”和“ceiling”这两个记号。

“floor 函数”也被称为“最大整数函数”(greatest integer)或“整数函数”(entier function),该函数获得的值是一个变量“x”的整数部分。

整除 or 地板除,一词两译哪个才是正确的?

“取整除”也是很对的,“取整除”运算取的就是除法结果的整数部分。

在中文中,“除法结果”有一个专门的术语,叫“商”。关于“商”:在英文中对应的说法叫做“quotient”。The word quotient is from the Latin 'quotiens', which means 'how many times'. A quotient is the answer to a division problem. A division problem describes 'how many times' a number will go into another. The first known usage of the word in mathematics is found around 1400-1500 AD in England.

除法问题描述的是:一个数字能“进入”到另一个数字的次数。这里“进入”应该翻译成“除”。

英文中一般这样描述:

Three goes into fifteen five times.

3除15得5。

16//3

This code shows that 3 goes into 16 five times:

To determine the quotient and remainder of a division, use the floor division and modulo operators, respectively.

“若要通过除法运算得到商和余数,可以分别使用‘取整除’(地板除)运算符和‘取模’运算符(取余运算符)。”

从编程学习者的角度来看,当了解了“floor”的来历后,“地板除”是一个非常形象易懂的翻译方法,求“地板上的数字”。而“ceiling division”,就是求“天花板上的数字”。

国内有一种译法,

就将“floor”对应的取整翻译成“向下取整”,把“ceiling”对应的取整翻译成“向上取整”。

终于深刻明白知友回答的意思了。

参考