From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Koch Subject: how to avoid floating number problems with org-table for finances? Date: Fri, 12 Oct 2012 19:06:59 +0200 Message-ID: <201210121907.00833.thomas@koch.ro> Reply-To: thomas@koch.ro Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:40589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMihZ-0002q5-Nj for emacs-orgmode@gnu.org; Fri, 12 Oct 2012 13:07:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMihY-0003ir-M6 for emacs-orgmode@gnu.org; Fri, 12 Oct 2012 13:07:09 -0400 Received: from koch.ro ([88.198.2.104]:45279) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMihY-0003ij-G1 for emacs-orgmode@gnu.org; Fri, 12 Oct 2012 13:07:08 -0400 Received: from 57-230.104-92.cust.bluewin.ch ([92.104.230.57] helo=x121e.localnet) by koch.ro with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1TMihW-0002Xl-Jv for emacs-orgmode@gnu.org; Fri, 12 Oct 2012 19:07:06 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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