emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* how to avoid 0.0 in an org-table
@ 2021-07-06  9:42 Uwe Brauer
  2021-07-06 11:48 ` Roger Mason
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Brauer @ 2021-07-06  9:42 UTC (permalink / raw)
  To: emacs-orgmode


Hi 

In the following example 

#+begin_src elisp
|     |    |   |   |  Res | Min |
|-----+----+---+---+------+-----|
|   0 |  0 | 0 | 0 |    0 | 0.0 |
| 1.2 | 10 | 1 | 1 | 13.2 | 0.1 |
#+TBLFM: $5=vsum($1..$4);f1::$6=min(10,$4)*0.1;f1 E
#+end_src

I obtain 0.0 in the last column, this looks bad, any idea how to avoid
it?

Thanks

Uwe Brauer 



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

* Re: how to avoid 0.0 in an org-table
  2021-07-06  9:42 how to avoid 0.0 in an org-table Uwe Brauer
@ 2021-07-06 11:48 ` Roger Mason
  2021-07-07  6:50   ` Uwe Brauer
  0 siblings, 1 reply; 5+ messages in thread
From: Roger Mason @ 2021-07-06 11:48 UTC (permalink / raw)
  To: emacs-orgmode

Hello Uwe,

Uwe Brauer writes:

> I obtain 0.0 in the last column, this looks bad, any idea how to avoid
> it?

I think you can use a printf format specification in the formula.

Cheers,
Roger


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

* Re: how to avoid 0.0 in an org-table
  2021-07-06 11:48 ` Roger Mason
@ 2021-07-07  6:50   ` Uwe Brauer
  2021-07-07  7:03     ` Greg Minshall
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Brauer @ 2021-07-07  6:50 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 834 bytes --]

>>> "RM" == Roger Mason <rmason@mun.ca> writes:

> Hello Uwe,
> Uwe Brauer writes:

>> I obtain 0.0 in the last column, this looks bad, any idea how to avoid
>> it?

> I think you can use a printf format specification in the formula.

Thanks I tried

#+begin_src elisp
|     |    |   |   |  Res | Min |
|-----+----+---+---+------+-----|
|   0 |  0 | 0 | 0 |    0 | 0.0 |
| 1.2 | 10 | 1 | 1 | 13.2 | 0.1 |
#+TBLFM: $5=vsum($1..$4);f1::$6=min(10,$4)*0.1;f1 E
#+end_src

#+begin_src elisp
|     |    |   |   |  Res | Min |
|-----+----+---+---+------+-----|
|   0 |  0 | 0 | 0 |    0 |   0.0 |
| 1.2 | 10 | 1 | 1 | 13.2 |   0.1 |
#+TBLFM: $5=vsum($1..$4);f1::$6=min(10,$4)*0.1;%0.1f
#+end_src


But it does not change, it seems if I want 0.1 I have to pay the price
to also obtain 0.0.

Regards

Uwe 


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: how to avoid 0.0 in an org-table
  2021-07-07  6:50   ` Uwe Brauer
@ 2021-07-07  7:03     ` Greg Minshall
  2021-07-07  7:10       ` Uwe Brauer
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Minshall @ 2021-07-07  7:03 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

Uwe,

your mileage may vary, but try
: #+TBLFM: $5=vsum($1..$4);f1::$6=min(10,$4)*0.1;%0.1g

(=man 3 printf= sort of implies that behavior might work for =%g=.)

cheers, Greg


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

* Re: how to avoid 0.0 in an org-table
  2021-07-07  7:03     ` Greg Minshall
@ 2021-07-07  7:10       ` Uwe Brauer
  0 siblings, 0 replies; 5+ messages in thread
From: Uwe Brauer @ 2021-07-07  7:10 UTC (permalink / raw)
  To: Greg Minshall; +Cc: Uwe Brauer, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

>>> "GM" == Greg Minshall <minshall@umich.edu> writes:

Hi Greg


> Uwe,
> your mileage may vary, but try
> : #+TBLFM: $5=vsum($1..$4);f1::$6=min(10,$4)*0.1;%0.1g

> (=man 3 printf= sort of implies that behavior might work for =%g=.)

Oops, thanks a lot I just did not realized the %g option (and I have
used printf in matlab quite a bit, shame on me).

Regards

Uwe 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

end of thread, other threads:[~2021-07-07  7:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-06  9:42 how to avoid 0.0 in an org-table Uwe Brauer
2021-07-06 11:48 ` Roger Mason
2021-07-07  6:50   ` Uwe Brauer
2021-07-07  7:03     ` Greg Minshall
2021-07-07  7:10       ` Uwe Brauer

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