Re: org-table-sum

2020-10-24 Thread Jeremie Juste
Hello, I have slightly improved the org-table-sum function. It calls directly calc-eval and yield the same result as vsum. It can not handle better floating points. > | 171.00 | > | 4.07 | > | 4.44 | > | 2.61 | > | 12.21 | > | 6.69 | > | 19.72 | > | 23.09 | > | 6.23 | > | 15.28 | >

Re: org-table-sum

2020-10-22 Thread Jeremie Juste
Hello 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

Re: org-table-sum

2020-09-28 Thread Robert Pluim
> On Mon, 28 Sep 2020 14:50:38 +0200, Jeremie Juste > said: >> >> You could make org-table-sum use calc, which would achieve the same. I >> donʼt think there'd be any complaints about floating-point additions >> suddenly being more accurate (famous last words)

Re: org-table-sum

2020-09-28 Thread Jeremie Juste
Hello Robert, Thanks for sharing your thoughts. > I suspect that the people using org-table sum would not want to split > the function in two: itʼs a useful utility function (and why split off > the integer summing? Thatʼs always going to be accurate). I see your point here and I agree with you.

Re: org-table-sum

2020-09-28 Thread Robert Pluim
> On Sun, 27 Sep 2020 01:07:22 +0200, Jeremie Juste > said: Jeremie> Hello, Jeremie> Thanks for the input. Jeremie> From what I understand, it seems that org-table-sum is not behaving as Jeremie> expected. I don't know if it would be interesting to split the function

Re: org-table-sum

2020-09-26 Thread Jeremie Juste
Hello, Thanks for the input. >From what I understand, it seems that org-table-sum is not behaving as expected. I don't know if it would be interesting to split the function into 2. One for summing of time values and one for summing integers? For the sum of integers (possibly real numbers) it

Re: org-table-sum

2020-09-25 Thread Robert Pluim
> On Thu, 24 Sep 2020 16:48:14 -0400, Kyle Meyer said: >> I did not find a way to reproduce this with other numbers, but the >> order seems to matter. Kyle> See . Exactly. Which is why you should use 'calc' with floating point numbers, it

Re: org-table-sum

2020-09-25 Thread Eric S Fraga
On Thursday, 24 Sep 2020 at 21:38, Kein Test wrote: > I found out about org-table-sum yesterday, but I quickly ran into a > problem, where the result is not right. It is right and due to the use of floating point arithmetic in the computer. If you ask org/calc to display the number with 2

Re: org-table-sum

2020-09-24 Thread Kyle Meyer
Kyle Meyer writes: > Here's what org-table-sum does underneath: > > (apply #'+ > (list 171.0 4.07 4.44 2.61 12.21 6.69 19.72 23.09 6.23 15.28 78.85)) > ;; => 1094.18998 Sorry, I pasted the wrong snippet (that one above has some numbers pruned and returns

Re: org-table-sum

2020-09-24 Thread Kyle Meyer
Kein Test writes: > Hi, > > I found out about org-table-sum yesterday, but I quickly ran into a > problem, where the result is not right. > > For example: > > | 171.00 | > | 4.07 | > | 4.44 | > | 2.61 | > | 12.21 | > | 6.69 | > | 19.72 | > | 23.09 | > | 6.23 | > | 15.28 | > | 250.00

Re: org-table-sum

2020-09-24 Thread Mark Janes
I can reproduce this with org 9.3.1. I imagine the decimal numbers have precision problems when converted to binary floating point. A simpler table to reproduce: | 83.6 | |.1 | |---| | 83.69 | Kein Test writes: > Hi, > > I found out