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
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
[-- 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 --]
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
[-- 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 --]