且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

强制转换为int VS地板

更新时间:2023-02-04 08:21:37

铸造为int会向零截断。 地板()将截断向负无穷大。这会给你不同的值,如果阴性。

Casting to an int will truncate toward zero. floor() will truncate toward negative infinite. This will give you different values if bar were negative.