[NTG-context] Number format with lua

Hans Hagen j.hagen at xs4all.nl
Sat Nov 9 11:20:37 CET 2019


On 11/9/2019 11:03 AM, Pablo Rodriguez wrote:
> On 11/9/19 10:38 AM, Fabrice Couvreur wrote:
>> Hi,
>> In the table below, how to have numbers with only three decimals?
> 
> Hi Fabrice,
> 
> at least in your sample "0.4g" seems the way to go, such as in:
> 
>    context.startxcell() context("%0.4g",1.031^i) context.stopxcell()
> 
> Just in case it might help,
better use %0.3f as %g is somewhat unpredictable; using %0.3N will omit 
redundant zeros (slower but not relevant here)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list