From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/105467 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Fabrice Couvreur Newsgroups: gmane.comp.tex.context Subject: Re: Number format with lua Date: Sat, 9 Nov 2019 11:42:57 +0100 Message-ID: References: <15a3d645-ba72-8f2e-b3f5-0479047452e4@gmx.es> <3ab5a76b-684f-9b7f-55f6-e0fa972285fe@xs4all.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5483431060136507197==" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="198541"; mail-complaints-to="usenet@blaine.gmane.org" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Nov 09 11:44:42 2019 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iTOET-000pVG-M2 for gctc-ntg-context-518@m.gmane.org; Sat, 09 Nov 2019 11:44:41 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id EE65B162CFD; Sat, 9 Nov 2019 11:44:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JYB5ZQoi-ZMC; Sat, 9 Nov 2019 11:44:23 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 32211162D01; Sat, 9 Nov 2019 11:44:23 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 335A2162CF9 for ; Sat, 9 Nov 2019 11:44:22 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0XTzQ3wQZ3fo for ; Sat, 9 Nov 2019 11:44:21 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.221.46; helo=mail-wr1-f46.google.com; envelope-from=fabrice1.couvreur@gmail.com; receiver= Original-Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 4F458162CF3 for ; Sat, 9 Nov 2019 11:44:21 +0100 (CET) Original-Received: by mail-wr1-f46.google.com with SMTP id p2so9754919wro.2 for ; Sat, 09 Nov 2019 02:44:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=RlhbgYvbTyX+BG3sowQu2t1eadxj8jdluMUjQ4zYNmc=; b=B5qACSc8U0zpBdBhHtcg7F9AjLWDLnB63z6sGFny1S7AijaU7EHyLiMM9Mak0J+umH SsQxpPQsb66IyF/kxuqbf1qt+5SNPPZ5vb6ZbtO1ATW/Rz3ocbNkIAfg+SFcz/8dmwD2 vYKgmSbAiJuOexto0swRfHuOdpy1kenP380Z4IM93MBd2uVvd1+BUIBPiHKKfr5EegDB PD6cpZSloMcqHwLX/Id1NOXLlahifayx7T6KEGxCMhukxFoKzgP/yMxrpWgFuYS2owqT ds5XfHRj07pWvbi/AsJgtbnCyXFZpPNGGa9ZPW+9RJeUeUD6Zjkcb7ssvEQOIu0X0M1o Bxcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=RlhbgYvbTyX+BG3sowQu2t1eadxj8jdluMUjQ4zYNmc=; b=l+YUyhLEagFtlrYqLCAF3SIV+lmLa69Rn+YIvS2+zkap5Uy1GnVLFf6E7oXHtKGXx4 XGuF93asdZGqNvg5FT5TSQWFUAYj04qYbAmNfP4M8P2uH3BlGsA/Z+6CRJMoZwngTUDz R0znl3QSK0Qho3c/rU+JNo9GrK+FkKK7kDKrAydT6aWng1ssxPxYl/u1KnJ4857oPMWE CEr4ikM9JOnT+9EEwKzkHvAVaNhBL9K/3V49SBLRBIagAGoeqi3cjFR9zY2KIw1WzrWf S2i4PlJCGySyiST1DE8Sk2jmERWZyd2JG3Ufv0RH4RwBgQSq4LjZPRnll3I/ywVdKHOB Wj7g== X-Gm-Message-State: APjAAAUfK9Ym5ZUYwMD3TDhVvnYc/CiqiDCYQRxfGRMxpBv5AVKHBXWt uRbF0+pSOLslClDFt3FL/w5Ndpa23KS0g6NOtCnbVEcX X-Google-Smtp-Source: APXvYqyG3D7uhHDD33zIBhdnvolxmS3h+pVsgJzYMnvOCdKdPwQLcYroTI0evuVmx/3ECnWfbllpP5KtoX1HfxBQ0eM= X-Received: by 2002:a5d:5227:: with SMTP id i7mr12264327wra.39.1573296260460; Sat, 09 Nov 2019 02:44:20 -0800 (PST) In-Reply-To: <3ab5a76b-684f-9b7f-55f6-e0fa972285fe@xs4all.nl> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:105467 Archived-At: --===============5483431060136507197== Content-Type: multipart/alternative; boundary="000000000000bb376e0596e7948f" --000000000000bb376e0596e7948f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Thank you for your suggestions, the problem is solved. I searched, but the solutions seemed too complex. Is it specific to Context with Lua. If so, which document should you read ? Fabrice Le sam. 9 nov. 2019 =C3=A0 11:20, Hans Hagen a =C3=A9cr= it : > 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 > ----------------------------------------------------------------- > > _________________________________________________________________________= __________ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > > _________________________________________________________________________= __________ > --000000000000bb376e0596e7948f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,
Thank you for your suggestions, the problem= is solved. I searched, but the so= lutions seemed too complex. Is it specific to Conte= xt with Lua. If so, which document should you read = ?
Fabrice

Le=C2=A0sam. 9 no= v. 2019 =C3=A0=C2=A011:20, Hans Hagen <j.hagen@xs4all.nl> a =C3=A9crit=C2=A0:
On 11/9/2019 11:03 AM, Pablo Rodriguez wr= ote:
> On 11/9/19 10:38 AM, Fabrice Couvreur wrote:
>> Hi,
>> In the table below, how to have numbers with only three decimals?<= br> >
> Hi Fabrice,
>
> at least in your sample "0.4g" seems the way to go, such as = in:
>
>=C2=A0 =C2=A0 context.startxcell() context("%0.4g",1.031^i) c= ontext.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

-----------------------------------------------------------------
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0Hans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Ridderstraat 27 | 80= 61 GH Hasselt | The Netherlands
=C2=A0 =C2=A0 =C2=A0 =C2=A0 tel: 038 477 53 69 | www.pragma-ade.nl | www.= pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/nt= g-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.net=
archive=C2=A0 : https://bitbucket.org/phg/context-m= irror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________
--000000000000bb376e0596e7948f-- --===============5483431060136507197== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============5483431060136507197==--