Math.round(11.5)等于多少? Math.round(-11.5)等于多少?
答:Math类中提供了三个与取整有关的方法:ceil、floor、round,这些方法的作用与它们的英文名称含义相对应。如ceil英文是天花板表示向上取整。如Math.ceil(-11.3)返回-11.floor英文是地板表示向下取整。如Math.floor(-11.3)返回 -12。round方法的算法是Math.flloor(x+0.5).如Math.round(--11.3)是Math.floor(-11.3+0.5) Math.floor(-10.8) 返回-11