[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-table-sum

From: Jeremie Juste
Subject: Re: org-table-sum
Date: Fri, 23 Oct 2020 00:20:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)


I have figured out that calc-eval might do the job for the floating
point problem for org.

(info "(calc) Calling Calc from Your Programs")

(calc-eval "83.6+0.1")

So in the function org-table-sum I have made the following modification:
> (res (string-to-number (calc-eval (combine-and-quote-strings  (mapcar 
> 'number-to-string numbers )  "+"))))

modified   lisp/org-table.el
@@ -4771,7 +4771,7 @@ If NLAST is a number, only the NLAST fields will actually 
be summed."
                              (nreverse items))))
             (numbers (delq nil (mapcar #'org-table--number-for-summing
-            (res (apply '+ numbers))
+            (res (string-to-number (calc-eval (combine-and-quote-strings  
(mapcar 'number-to-string numbers )  "+"))))
             (sres (if (= org-timecnt 0)
                       (number-to-string res)
                     (setq diff (* 3600 res)

I believe that the org-table--number-for-summing function can be
bypassed but my elisp foo is weak. Feel free to improve.

Best regards

reply via email to

[Prev in Thread] Current Thread [Next in Thread]