From: Hans Hagen <pragma@wxs.nl>
To: Troy Henderson <thenders@gmail.com>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Numerical Calculations
Date: Wed, 19 Dec 2012 20:25:45 +0100 [thread overview]
Message-ID: <50D214B9.2080703@wxs.nl> (raw)
In-Reply-To: <CAFP+xFK1g=y+rvkdXHnA-LoDQmS-fcx_m9BrmFQ2ST29Ki6t7Q@mail.gmail.com>
On 12/19/2012 7:43 PM, Troy Henderson wrote:
> Do \luaexpr{1/3.8} and \ctxcommand{format("@0.3f",1/3.8)} return numbers
> or strings? That is, I would like to use these results in a \if or
> \ifnum command to exit a \doloop.
they return tokens i.e.
\ifnum\luaexpr{math.round(1/3.8)}>1\relax
should work ok; it all depends on what you do, but you could also set a
counter ans use that:
\ctxlua{tex.count.scratchcounter=math.round(1/3.8)}
\ifnum\scratchcounter>0
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| 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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2012-12-19 19:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-19 18:09 Troy Henderson
2012-12-19 18:16 ` Thomas A. Schmitz
2012-12-19 18:18 ` Hans Hagen
2012-12-19 18:19 ` Hans Hagen
2012-12-19 18:43 ` Troy Henderson
2012-12-19 19:19 ` Roland Thiers
2012-12-19 19:26 ` Hans Hagen
2012-12-19 19:25 ` Hans Hagen [this message]
[not found] ` <CAFP+xFK89EWiM7SbhVvZKPe1Hv2UKNGAgo6B8kaJNaE363dWpA@mail.gmail.com>
[not found] ` <CAFP+xFJqt=j-3B1y2LpYj6Xuu19viGScjEea=rN5FtVsotd3yw@mail.gmail.com>
2012-12-19 20:30 ` Hans Hagen
2012-12-19 20:54 ` Troy Henderson
2012-12-19 22:05 ` Marco Patzer
2012-12-19 22:10 ` Troy Henderson
2012-12-19 23:03 ` Troy Henderson
2012-12-21 12:22 ` Andre Caldas
2012-12-21 12:56 ` Troy Henderson
2012-12-19 23:20 ` Marco Patzer
2012-12-19 19:32 ` Philipp Gesang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50D214B9.2080703@wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
--cc=thenders@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).