emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* decimal fractions when summing up large numbers
@ 2008-09-24 15:15 Rainer Thiel
  2008-09-24 15:38 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Rainer Thiel @ 2008-09-24 15:15 UTC (permalink / raw)
  To: emacs-orgmode

I have a problem I am confident there is a solution to.  I even
suspect it may be explained in the manual, but can't for the life of
me find it:

Summing up small numbers in tables isn't a problem even when they have
digits after the decimal point.  For example, org-table-sum applied on
the table

| 10000.7 |
| 10000.5 |
| 10000.3 |

correctly gives 30001.5.  On the other hand, applied on the table

| 100000.7 |
| 100000.5 |
| 100000.3 |

org-table-sum gives 300002, the correctly rounded value of 300001.5,
which would be the exact value.

How can I make org-table-sum deliver the exact value?

If this is explained in the manual, please point me to the relevant section.

Many thanks in advance

Rainer
-- 
Prof. Dr. Rainer Thiel
Institut für Altertumswissenschaften
07737 Jena, Germany (EU)
r.thiel@uni-jena.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: decimal fractions when summing up large numbers
  2008-09-24 15:15 decimal fractions when summing up large numbers Rainer Thiel
@ 2008-09-24 15:38 ` Carsten Dominik
  2008-09-24 15:49   ` Bernt Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2008-09-24 15:38 UTC (permalink / raw)
  To: r.thiel; +Cc: emacs-orgmode

Hi Rainer,

turns out, org-table-sum is an old function I have not looked at for a  
long time.  It used (format "%g" res) to format the final result for  
display - bad idea indeed, because that causes the unwanted rounding.

I have removed this, the change has just been pushed to the git repo.

Thanks for the report.

- Carsten

On Sep 24, 2008, at 5:15 PM, Rainer Thiel wrote:

> I have a problem I am confident there is a solution to.  I even
> suspect it may be explained in the manual, but can't for the life of
> me find it:
>
> Summing up small numbers in tables isn't a problem even when they have
> digits after the decimal point.  For example, org-table-sum applied on
> the table
>
> | 10000.7 |
> | 10000.5 |
> | 10000.3 |
>
> correctly gives 30001.5.  On the other hand, applied on the table
>
> | 100000.7 |
> | 100000.5 |
> | 100000.3 |
>
> org-table-sum gives 300002, the correctly rounded value of 300001.5,
> which would be the exact value.
>
> How can I make org-table-sum deliver the exact value?
>
> If this is explained in the manual, please point me to the relevant  
> section.
>
> Many thanks in advance
>
> Rainer
> -- 
> Prof. Dr. Rainer Thiel
> Institut für Altertumswissenschaften
> 07737 Jena, Germany (EU)
> r.thiel@uni-jena.de
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: decimal fractions when summing up large numbers
  2008-09-24 15:38 ` Carsten Dominik
@ 2008-09-24 15:49   ` Bernt Hansen
  0 siblings, 0 replies; 3+ messages in thread
From: Bernt Hansen @ 2008-09-24 15:49 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode, r.thiel

Carsten Dominik <dominik@uva.nl> writes:

> turns out, org-table-sum is an old function I have not looked at for a
> long time.  It used (format "%g" res) to format the final result for
> display - bad idea indeed, because that causes the unwanted rounding.
>
> I have removed this, the change has just been pushed to the git repo.
>

:)

Carsten is too fast.  I was going to ship a patch that just changed %g
to %s in the format call (since that seemed to work for me) but when I
pulled the new code from git master it was already fixed.

Great job Carsten!

Rainer: Oh and thanks for bringing this up - I didn't know about C-c +
        in tables until a few minutes ago. :)

-Bernt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-09-24 15:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-24 15:15 decimal fractions when summing up large numbers Rainer Thiel
2008-09-24 15:38 ` Carsten Dominik
2008-09-24 15:49   ` Bernt Hansen

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).