emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thomas Koch <thomas@koch.ro>
To: emacs-orgmode@gnu.org
Subject: how to avoid floating number problems with org-table for finances?
Date: Fri, 12 Oct 2012 19:06:59 +0200	[thread overview]
Message-ID: <201210121907.00833.thomas@koch.ro> (raw)

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.9000000000000000222044604925031308084726 |
#+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

             reply	other threads:[~2012-10-12 17:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-12 17:06 Thomas Koch [this message]
2012-10-12 18:00 ` how to avoid floating number problems with org-table for finances? Johan Sandblom
2012-10-12 18:04 ` Johan Sandblom
2012-11-01 18:04 ` Michael Brand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201210121907.00833.thomas@koch.ro \
    --to=thomas@koch.ro \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).