[oct-cvs] Oct commit: oct qd-io.lisp
rtoy
rtoy at common-lisp.net
Wed Feb 9 19:28:00 UTC 2011
Update of /project/oct/cvsroot/oct
In directory cl-net:/tmp/cvs-serv367
Modified Files:
qd-io.lisp
Log Message:
Change MAKE-FLOAT to multiply by the sign AFTER we've created the
quad-double. This way we create signed quad-double zeroes correctly.
Previously, the sign was applied to the rational which loses the sign
if the rational is 0.
--- /project/oct/cvsroot/oct/qd-io.lisp 2008/07/16 21:02:07 1.22
+++ /project/oct/cvsroot/oct/qd-io.lisp 2011/02/09 19:28:00 1.23
@@ -1,6 +1,6 @@
;;;; -*- Mode: lisp -*-
;;;;
-;;;; Copyright (c) 2007 Raymond Toy
+;;;; Copyright (c) 2007, 2011 Raymond Toy
;;;;
;;;; Permission is hereby granted, free of charge, to any person
;;;; obtaining a copy of this software and associated documentation
@@ -402,10 +402,11 @@
(declare (type (member -1 1) sign)
(type unsigned-byte int-part frac-part)
(fixnum scale exp))
- (rational-to-qd (* sign
- (* (+ int-part (/ frac-part (expt 10 scale)))
- (expt 10 exp)))))
-
+ (let ((qd (rational-to-qd (* (+ int-part (/ frac-part (expt 10 scale)))
+ (expt 10 exp)))))
+ (if (minusp sign)
+ (neg-qd qd)
+ qd)))
;; This seems to work, but really needs to be rewritten!
(defun read-qd (stream)
More information about the oct-cvs
mailing list