关于算法四舍五入的问题 求高手解答 谢谢
(defun c:ss ()
(setq x(getdist "\n输入文本新的字高: "))
;(setq x(/ x 100))
(princ x)
(princ "\n")
(if (> x 0)
(progn
(if (>= (- x (fix x)) 0.5)
(setq x(+ (fix x) 1))
(fix x)
)
)
(progn
(if (>= (- x (fix x)) -0.5)
(fix x)
(setq x(- (fix x) 1))
)
)
)
(princ x)
(princ "\n")
;(setq x(* x 100))
(princ x)
(princ "\n")
)
=======================
当 ;(setq x(/ x 100))
;(setq x(* x 100))
没有时可以四舍五入
当加上后不可以
求高手解答 谢谢 (defun ssz (x)
(setq x(/ x 100))
(if (> x 0)
(setq x(fix (+ x0.5)))
(setq x(fix (- x0.5)))
)
(setq x(* x 100))
)
已经解决
页:
[1]