سبع الليل 发表于 2022-7-5 16:06:23

数字的四舍五入是多少

嗨,伙计们
你好
在excel中,我们以这个函数=天花板(数字;05)为例
在autolisp中,执行此操作的相同函数是什么??
一、 E:如果我有一个数字(2.63)。。。我希望cad将其作为(2.65)
我必须用什么??
我假设我可以使用(上限2.63 0.05)
但它的功能不好
谢谢你,很抱歉我的英语不好

ReMark 发表于 2022-7-5 16:31:30

Lee Mac介绍的autolisp中的舍入函数。
 
http://lee-mac.com/round.html

Lee Mac 发表于 2022-7-5 16:54:38

考虑以下功能:
;; Round Up-Lee Mac
;; Rounds 'n' up to the nearest 'm'

(defun LM:roundup ( n m )
   (cond
       ((equal 0.0 (rem n m) 1e- n)
       ((< n 0) (- n (rem n m)))
       ((+ n (- m (rem n m))))
   )
)
 
用法示例:
_$ (LM:roundup 2.61 0.05)
2.65

سبع الليل 发表于 2022-7-5 17:23:04

非常感谢
你们是很棒的人
页: [1]
查看完整版本: 数字的四舍五入是多少