Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by h1439878.stratoserver.net (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id t8N84Vnk017300 for ; Wed, 23 Sep 2015 10:04:32 +0200 Received: from relay2.uni-heidelberg.de ([129.206.119.212]) by mx-ha.gmx.net (mxgmx105) with ESMTPS (Nemesis) id 0Lf05b-1aUE5O1QtD-00qmjQ for ; Wed, 23 Sep 2015 10:04:26 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t8N82SfI000957 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 23 Sep 2015 10:02:29 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t8N6FLZT020446; Wed, 23 Sep 2015 10:02:28 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 12544308 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Wed, 23 Sep 2015 10:02:28 +0200 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.119.212]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t8N82SQw032280 for ; Wed, 23 Sep 2015 10:02:28 +0200 Received: from ftx-008-i769.relay.mailchannels.net (ftx-008-i769.relay.mailchannels.net [50.61.143.69]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t8N82Ltx000884 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 23 Sep 2015 10:02:25 +0200 X-Sender-Id: netnames|x-authuser|joseph.wright@morningstar2.co.uk Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 7AF4442AA for ; Wed, 23 Sep 2015 08:02:20 +0000 (UTC) Received: from smtp3.easily.co.uk (ip-10-204-4-183.us-west-2.compute.internal [10.204.4.183]) by relay.mailchannels.net (Postfix) with ESMTPA id 057384660 for ; Wed, 23 Sep 2015 08:02:18 +0000 (UTC) X-Sender-Id: netnames|x-authuser|joseph.wright@morningstar2.co.uk Received: from smtp3.easily.co.uk (smtp3.easily.co.uk [10.42.130.4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA) by 0.0.0.0:2500 (trex/5.5.3); Wed, 23 Sep 2015 08:02:20 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: netnames|x-authuser|joseph.wright@morningstar2.co.uk X-MailChannels-Auth-Id: netnames X-MC-Loop-Signature: 1442995339569:2428683554 X-MC-Ingress-Time: 1442995339568 Received: from [139.222.114.163] (port=51044 helo=[139.222.114.163]) by smtp3.easily.co.uk with esmtpa (Exim 4.43) id 1Zef0K-0007Ll-Nk for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Wed, 23 Sep 2015 09:02:16 +0100 References: <56020530.4070302@clear.net.nz> X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-AuthUser: joseph.wright@morningstar2.co.uk Message-ID: <56025C88.6050307@morningstar2.co.uk> Date: Wed, 23 Sep 2015 09:02:16 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: An incomplete int-erface? To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <56020530.4070302@clear.net.nz> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:KGE4bbnpyxI=:fsQMdDfvPWQr8z/54PJ/bBS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uJxmqRE5FW6BBcMznx8B X-Scanned-By: MIMEDefang 2.71 on 85.214.41.38 Status: R X-Status: X-Keywords: X-UID: 7888 On 23/09/2015 02:49, Andrew Parsloe wrote: > \int_eval:n { - (1+2) } > > gives a "Missing number, treated as zero" message. So does \int_eval:n { > + (1+2) }. But > > \int_eval:n { 0 - (1+2) } > > evaluates correctly. If + ( or - ( are the first members of an integer > argument, an error results; if they are not the first members, they are > accepted by \int_eval:n etc. I don't know that this is a bug as such but > it certainly feels to me like an untidiness in the l3int interface. It > means that the order in which component parts of an expression are > presented to \int_eval:n matters, even though in an arithmetical sense, > they evaluate to the same number. > > I query too whether an expression like > > \int_eval:n { 3(1+2) } > > should "evaluate" to 3(1+2), rather than 9, without showing an error. > > (Alternatively, I find myself wondering what would be entailed to > harmonize the integer interface with the fp one (which has no problem > with these expressions)? Then one could choose whether to evaluate an > expression involving integral numerals in l3fp or l3int without having > to change the expression, as one does at present. For instance, if the > expression involves an exponent, use l3fp; if not use l3int. This choice > becomes more complicated when the expression itself needs to be changed.) > > Andrew The different 'behind the scenes' here is that \int_eval:n is just the engine \numexpr primitive in a macro wrapper, but \fp_eval:n is implemented entirely in macros (as there is no floating-point primitive). Thus while we can alter the parser for fp work, we can't for int work, or rather not without significant changes. In particular, there would be a performance implication in parsing int input and doing the calculations 'by hand'. I suspect int parsing would be easier than for fp expressions, but even so this looks like a significant effort. As Will has commented, we might manage at low cost to avoid the bracket issue, but allowing \int_eval:n { 3(1+2) } would be rather more tricky. Indeed, I'd probably say we shouldn't: here I think requiring an explicit "*" is the right approach. Bruno is best-placed to comment on the fp implementation here. The reason I'm wary of making any changes, quite apart from effort both in terms of the team and in terms of TeX when using expressions, is that life gets more complex when you look at dim/skip/muskip cases. There, the underlying primitives have particular requirements, thus \dim_eval:n { 4pt * 3 } is valid but \dim_eval:n { 3 * 4pt } is not. I really don't think we want to implement all of the necessary parsing for this by hand, so saying that we follow the underlying primitive requirements is a position I think we are best with in general. BTW, as far as I know there is nothing that would be valid for an int expr. that would fail for l3fp. Joseph