math.round()问题math.round(-10.6)=-11.这个我能理解, 但是math.round(-10

math.round()问题
math.round(-10.6)=-11.这个我能理解, 但是math.round(-10.5)返回值为什么是-10 而不是-11 不应该四舍五吗
antion316 1年前 已收到1个回答 举报

wuti_2006 春芽

共回答了9个问题采纳率:88.9% 举报

ound()方法你可以这样理就是括号内的数+0.5之后,向下取值,比如:round(3.4)就是3.4+0.5=3.9,向下取值是3,所以round(3.4)=3; 那么round(-10.5)就是-10.5+0.5=-10,向下取值就是-10,所以round(-10.5)=-10

1年前

1
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 0.029 s. - webmaster@yulucn.com