diff options
Diffstat (limited to 'lisp/calc/calc-misc.el')
-rw-r--r-- | lisp/calc/calc-misc.el | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lisp/calc/calc-misc.el b/lisp/calc/calc-misc.el index 7c97dc6a9a0..2db09e2b677 100644 --- a/lisp/calc/calc-misc.el +++ b/lisp/calc/calc-misc.el @@ -757,19 +757,21 @@ loaded and the keystroke automatically re-typed." ;; The variable math-trunc-prec is local to math-trunc, but used by ;; math-trunc-fancy in calc-arith.el, which is called by math-trunc. +(defvar math-trunc-prec) ;;;###autoload -(defun math-trunc (a &optional math-trunc-prec) - (cond (math-trunc-prec +(defun math-trunc (a &optional trunc-prec) + (cond (trunc-prec (require 'calc-ext) - (math-trunc-special a math-trunc-prec)) + (math-trunc-special a trunc-prec)) ((Math-integerp a) a) ((Math-looks-negp a) (math-neg (math-trunc (math-neg a)))) ((eq (car a) 'float) (math-scale-int (nth 1 a) (nth 2 a))) (t (require 'calc-ext) - (math-trunc-fancy a)))) + (let ((math-trunc-prec trunc-prec)) + (math-trunc-fancy a))))) ;;;###autoload (defalias 'calcFunc-trunc 'math-trunc) @@ -777,12 +779,13 @@ loaded and the keystroke automatically re-typed." ;; The variable math-floor-prec is local to math-floor, but used by ;; math-floor-fancy in calc-arith.el, which is called by math-floor. +(defvar math-floor-prec) ;;;###autoload -(defun math-floor (a &optional math-floor-prec) ; [Public] - (cond (math-floor-prec +(defun math-floor (a &optional floor-prec) ; [Public] + (cond (floor-prec (require 'calc-ext) - (math-floor-special a math-floor-prec)) + (math-floor-special a floor-prec)) ((Math-integerp a) a) ((Math-messy-integerp a) (math-trunc a)) ((Math-realp a) @@ -790,7 +793,9 @@ loaded and the keystroke automatically re-typed." (math-add (math-trunc a) -1) (math-trunc a))) (t (require 'calc-ext) - (math-floor-fancy a)))) + (let ((math-floor-prec floor-prec)) + (math-floor-fancy a))))) + ;;;###autoload (defalias 'calcFunc-floor 'math-floor) |