ソースを参照

Avoid rounding errors whe summing table columns.

Carsten Dominik 16 年 前
コミット
7b54d28c30
2 ファイル変更4 行追加1 行削除
  1. 3 0
      lisp/ChangeLog
  2. 1 1
      lisp/org-table.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2008-09-24  Carsten Dominik  <dominik@science.uva.nl>
 
+	* org-table.el (org-table-sum): Do not format the result with %g,
+	it does rounding when there are too many digits.
+
 	* org.el (org-map-entries): Protect the keyword-selecting variables.
 
 2008-09-23  Bastien Guerry  <bzg@altern.org>

+ 1 - 1
lisp/org-table.el

@@ -1644,7 +1644,7 @@ If NLAST is a number, only the NLAST fields will actually be summed."
 					items1)))
 	     (res (apply '+ numbers))
 	     (sres (if (= org-timecnt 0)
-		       (format "%g" res)
+		       (number-to-string res)
 		     (setq diff (* 3600 res)
 			   h (floor (/ diff 3600)) diff (mod diff 3600)
 			   m (floor (/ diff 60)) diff (mod diff 60)