portia

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

转自http://hi.baidu.com/lxfjiangsu/blog/item/49d7621f0b93630d304e15d0.html

(1)fix(x) : 截尾取整.

>> fix( [3.12 -3.12])

ans =

     3    -3
(2)floor(x):不超过x 的最大整数.(高斯取整)

>> floor( [3.12 -3.12])

ans =

     3    -4

(3)ceil(x) : 大于x 的最小整数

>> ceil( [3.12 -3.12])

ans =

     4    -3

(4)四舍五入取整

>> round(3.12 -3.12)

ans =

     0

>> round([3.12 -3.12])

ans =

     3    -3

>>

posted on 2011-12-24 14:36  portia  阅读(254)  评论(0)    收藏  举报