[O] how to avoid floating number problems with org-table for finances?

2012-10-12 Thread Thomas Koch
Hi,

I use a simple org-mode table to sum up the expenses and incomes of a small 
private project. Now I remembered that I should know as a programmer to NEVER 
EVER USE FLOATS FOR FINANCES!!!

But I did...

|0.3 |
|0.3 |
|0.3 |
| 0.9000222044604925031308084726 |
#+TBLFM: @4$1=vsum(@1..@3);%.40f

Do you know any quirck how I can continue using point notation but be sure 
that the numbers are added correctly? I think I'd need another vsum method 
that would

- find the number of decimal points of the most precise field
- parse all numbers to integers by filling up zeros at the end and ignoring 
the decimal point
- sum up
- write the result with a decimal point at the right position

Best regards,

Thomas Koch, http://www.koch.ro



Re: [O] how to avoid floating number problems with org-table for finances?

2012-10-12 Thread Johan Sandblom

Sorry, I meant

#+TBLFM: @4$1=round(vsum(@1..@3),2);%.40f

Johan

--
Johan Sandblom, MD PhD
m +46735521477
What is wanted is not the will to believe, but the
will to find out, which is the exact opposite
--Bertrand Russell



Re: [O] how to avoid floating number problems with org-table for finances?

2012-10-12 Thread Johan Sandblom

Not what you asked for, but how about simply rounding it?

2012-10-12 19:06 skrev Thomas Koch:

| 0.9000222044604925031308084726 |
#+TBLFM: @4$1=vsum(@1..@3);%.40f


#+TBLFM: @4$1=round(vsum(@1..@3);%.40f

--
Johan Sandblom, MD PhD
m +46735521477
What is wanted is not the will to believe, but the
will to find out, which is the exact opposite
--Bertrand Russell