* Rounding in org-mode tables
@ 2007-08-26 2:00 James Hawley
2007-08-26 18:25 ` Carsten Dominik
0 siblings, 1 reply; 3+ messages in thread
From: James Hawley @ 2007-08-26 2:00 UTC (permalink / raw)
To: emacs-orgmode
Hi!
I'm a relatively new emacs and org-mode user so I apologize for the
basic nature of this question. Unfortunately, the answer is probably so
obvious that no one has had to ask it before, and, as a result, I have
not been able to find this subject in the mailing list. Of course, I
may not be doing a good search, so please accept another apology.
Anyway, all I am trying to do is to sum a column of numbers in a table
in an org file. Here's an example:
935.15
6483.80
7419.00
#+TBLFM: @16$4=vsum(@3$4..@4$4);%.2f
The answer is obviously being rounded but I don't want that and I
cannot figure out the undoubtedly trivial way to stop it so I get the
answer that I want to see - 7418.95.
Thanks for any help anyone offers on this simple (but frustrating for
me) question.
Jim Hawley
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Rounding in org-mode tables
2007-08-26 2:00 Rounding in org-mode tables James Hawley
@ 2007-08-26 18:25 ` Carsten Dominik
2007-08-31 1:49 ` James Hawley
0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2007-08-26 18:25 UTC (permalink / raw)
To: James Hawley; +Cc: emacs-orgmode
On Aug 26, 2007, at 4:00, James Hawley wrote:
> Hi!
>
> I'm a relatively new emacs and org-mode user so I apologize for the
> basic nature of this question. Unfortunately, the answer is probably
> so obvious that no one has had to ask it before, and, as a result, I
> have not been able to find this subject in the mailing list. Of
> course, I may not be doing a good search, so please accept another
> apology.
>
> Anyway, all I am trying to do is to sum a column of numbers in a table
> in an org file. Here's an example:
>
> 935.15
> 6483.80
> 7419.00
> #+TBLFM: @16$4=vsum(@3$4..@4$4);%.2f
>
> The answer is obviously being rounded but I don't want that and I
> cannot figure out the undoubtedly trivial way to stop it so I get the
> answer that I want to see - 7418.95.
>
> Thanks for any help anyone offers on this simple (but frustrating for
> me) question.
Org-mode uses a relatively compact output format for calc in order
to avoid that fields get too wide. You can fix this by changing
the default format in `org-calc-default-mode' from (float 5) to (float
8)
or so, but that means each time a number is produced with many digits,
all 8 will be displayed.
The other option is to change the format on the fly, just for a specific
formula, using (again for example) an f8 flag, like
$4 = vsum($1..$3);f8
Hope this helps.
- Carsten
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Rounding in org-mode tables
2007-08-26 18:25 ` Carsten Dominik
@ 2007-08-31 1:49 ` James Hawley
0 siblings, 0 replies; 3+ messages in thread
From: James Hawley @ 2007-08-31 1:49 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode
Carsten,
Many Thanks for your rapid response - your suggestion worked and your
caution was helpful as well (e.g., using f7 showed 3 additional zeros).
For anyone reading the list that might be interested, here's how I
fixed the example to get the two digits to the right of the decimal to
print correctly.
Original table and formula
935.15
6483.80
7419.00
#+TBLFM: @16$4=vsum(@3$4..@4$4);%.2f Original formula yields 7419.00
Fixed table and formula
935.15
6483.80
7419.00
#+TBLFM: @16$4=vsum(@3$4..@4$4);f6%.2f Revised formula yields 7418.95
^^
added formatting
Jim
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-31 1:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-26 2:00 Rounding in org-mode tables James Hawley
2007-08-26 18:25 ` Carsten Dominik
2007-08-31 1:49 ` James Hawley
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).