From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/53657 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: format float numbers in luatex Date: Sun, 25 Oct 2009 09:07:59 +0100 Message-ID: <8033F938-E074-4D19-91F0-A56252C5BA7E@googlemail.com> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1076) Content-Type: text/plain; charset="us-ascii"; Format="flowed"; DelSp="yes" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1256458101 7878 80.91.229.12 (25 Oct 2009 08:08:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Oct 2009 08:08:21 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Oct 25 09:08:14 2009 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.50) id 1N1y97-0007Rh-4J for gctc-ntg-context-518@m.gmane.org; Sun, 25 Oct 2009 09:08:13 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0F91BC9B99; Sun, 25 Oct 2009 09:07:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id hSOgRHChBVkM; Sun, 25 Oct 2009 09:07:02 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 70DCFC9B0D; Sun, 25 Oct 2009 09:07:02 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 28EE1C9B0D for ; Sun, 25 Oct 2009 09:07:01 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id aSjASqGYtB+e for ; Sun, 25 Oct 2009 09:06:58 +0100 (CET) Original-Received: from mail-fx0-f219.google.com (mail-fx0-f219.google.com [209.85.220.219]) by balder.ntg.nl (Postfix) with ESMTP id C36C9C9A70 for ; Sun, 25 Oct 2009 09:06:58 +0100 (CET) Original-Received: by fxm19 with SMTP id 19so11589220fxm.2 for ; Sun, 25 Oct 2009 01:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :subject:from:in-reply-to:date:content-transfer-encoding:message-id :references:to:x-mailer; bh=uOsdz+BBZvvkXcHsMVBktEkpEutmqu2GRRUz7Ep4VPQ=; b=hvrzoTRxj96NRhNEDCNFFLFXjhwv1F03UstTWJV4sadW4uGSMYmw97u9bApg9zdEJr wlxjgS/bKwodFTYAZCkOaayVpDKZyk6vjJRFe04NhDiHaOybnSBUZQfKVo87UfsJ1+Hm jPIPm7woaKdMGnNjR6PaQKEIWhBYgFwG87QbI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=EbEKlM4dv1LLpkB8GLWmHNfZ96E6XyTK5NBvK5bcMGKBcx9gJdFib3+Ood9cHPDpeH LjDncCNtqauN3baOuQP6cF8T8FrujkfXIMLc9yQETgBdY9jHNSlFjxFoHTnoXjZsjMbV lSvdHwUYtmMnuml6SzsbBMuJ4K4ahBiYiRryQ= Original-Received: by 10.103.81.35 with SMTP id i35mr1906987mul.43.1256458082089; Sun, 25 Oct 2009 01:08:02 -0700 (PDT) Original-Received: from ?192.168.2.23? (p54956B4C.dip.t-dialin.net [84.149.107.76]) by mx.google.com with ESMTPS id u9sm9103305muf.31.2009.10.25.01.08.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 25 Oct 2009 01:08:01 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.1076) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:53657 Archived-At: Am 24.10.2009 um 18:59 schrieb batela: > Dear Sirs, > > I'm looking a way to format float numbers. For example \ctxlua > {text.print(sqrt(2))} give me 1.41421356237309504880 but i want 1.414. > > Is there a way to format real numbers. > > Note: I had tried \ctxlua{a = sqrt(a) ; aformat = string.format > ("0.3%f", a) ; text.print(aformat)} > > but that don't work because the % character \ctxlua{text.sprint(string.format("0.3\%f",sqrt(2)))} or \ctxlua{text.sprint(string.format("0.3\letterpercent f",sqrt(2)))} Wolfgang ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________