[oct-cvs] Oct commit: oct qd-methods.lisp
rtoy
rtoy at common-lisp.net
Mon Sep 24 21:30:07 UTC 2007
Update of /project/oct/cvsroot/oct
In directory clnet:/tmp/cvs-serv16245
Modified Files:
qd-methods.lisp
Log Message:
Minor optimization converting a rational to a qd-real. If the
denominator is 1, skip the qd-real division.
--- /project/oct/cvsroot/oct/qd-methods.lisp 2007/09/20 21:04:05 1.60
+++ /project/oct/cvsroot/oct/qd-methods.lisp 2007/09/24 21:30:07 1.61
@@ -81,9 +81,11 @@
;; We should do something better than this.
(let ((top (numerator x))
(bot (denominator x)))
- (make-instance 'qd-real
- :value (div-qd (qdi::make-float (signum top) (abs top) 0 0 0)
- (qdi::make-float (signum bot) (abs bot) 0 0 0)))))
+ (if (= bot 1)
+ (make-instance 'qd-real :value (qdi::make-float (signum top) (abs top) 0 0 0))
+ (make-instance 'qd-real
+ :value (div-qd (qdi::make-float (signum top) (abs top) 0 0 0)
+ (qdi::make-float (signum bot) (abs bot) 0 0 0))))))
(defmethod add1 ((a number))
More information about the oct-cvs
mailing list