Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with ESMTP id s6BGQadt005839 for ; Fri, 11 Jul 2014 18:26:37 +0200 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx105) with ESMTPS (Nemesis) id 0MVrgy-1X3X820OPA-00X2kE for ; Fri, 11 Jul 2014 18:26:31 +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 s6BGMSAv008823 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 11 Jul 2014 18:22:28 +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 s6BAfvPO030731; Fri, 11 Jul 2014 18:22:27 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 11136838 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 11 Jul 2014 18:22:27 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s6BGMRNc002968 for ; Fri, 11 Jul 2014 18:22:27 +0200 Received: from mail-qg0-f47.google.com (mail-qg0-f47.google.com [209.85.192.47]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id s6BGMFVN017461 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Fri, 11 Jul 2014 18:22:18 +0200 Received: by mail-qg0-f47.google.com with SMTP id q108so1139647qgd.6 for ; Fri, 11 Jul 2014 09:22:15 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.224.132.132 with SMTP id b4mr94090124qat.33.1405095735241; Fri, 11 Jul 2014 09:22:15 -0700 (PDT) Received: by 10.96.212.1 with HTTP; Fri, 11 Jul 2014 09:22:15 -0700 (PDT) References: <539432A6.7030205@clear.net.nz> <5395A7A3.7040106@residenset.net> <5395AA02.8040704@morningstar2.co.uk> <53BF9FD5.8070805@clear.net.nz> Content-Type: text/plain; charset=UTF-8 Message-ID: Date: Fri, 11 Jul 2014 12:22:15 -0400 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Bruno Le Floch Subject: Re: Juxtaposition in l3fp To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <53BF9FD5.8070805@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:EHat7sHJr/g=:tMr+fqnds6+1HVylxxAFf+7YnU P9zRjSIQm2BpexFDip9RcS+YGAj5l/0HgnMd5b6sGLUQQomTh+Ugi++GDkg0gC7cD6I+Izgry VAWoQvo0sSeRW7YI5k79EkijVe9/4BXldB0nDf3Y2xtHxUMRnP5fkFRKAIDo1ut4ZqNHRE9AB fFqPG8M+FRuDeMQNLd1bkd0VtIz4SXp/XOw9j6DMXz91ki/gVtx+O8cSHC6xFaThunV5+Wefo iC++pQjEAxhMrVetShD2OSJHMC8EwBvm2U/pgX7J2i7WjXrEK5JWoT6fW7qbG6Rux1hZ25zZ9 Lp3YGtBL1RSTTkkyqepYAoQJkKuEaThMD1p1UcoUkHWmJhoFTh8wyMxr0aBUVEu166UoMKhMm cEqG9Vd3aJ2X+ezPULeHyxCxiN/c4m6n2wQ+Z3RMCoc+66qB5GM/6raXF4KseKHnL/kl3AMxP saseyxjWt5vdOFlh0ty1mHHPQUeKUgWunrqFx5mFqJtyuMBY2ZQR0naPe1r7scM+feZxfqCe0 TVFCKUGLznkL7ZEVSOOFWBEoYwHOjXD4647Kr9waMwd80TOMOsad2eSMpLdJKaanCD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14, aparsloe wrote: > On 11/07/2014 11:20 a.m., Bruno Le Floch wrote: >> Hello list, >> >> Sorry for the >1 month delay. This is a followup to the thread asking >> whether letting juxtaposition denote multiplication was a good idea. >> I think it was, but I made a big mistake in making juxtaposition be >> multiplication with a _different precedence_ than the asterisk. > ... >> In l3fp, I pushed the idea to its extreme, allowing juxtaposition for >> things other than units, and I kept the precedence as being the >> tightest possible. >> >> As Lars rightfully says it's "consistent, but not necessarily >> intuitive". Andrew has given several cases where my choice leads to a >> terrible behaviour for l3fp, and there is basically no case where the >> current behaviour is better (well, there was one abusive one: with >> this rule, exp.5ln(...) computes the square root, but now that is not >> needed). > Actually, I've found this "abuse" quite a handy device, and despite the > introduction of the sqrt function to l3fp, for n-th roots, exp(1/n)ln > has a certain convenience. Well, that won't work once we change the precedence of juxtaposition to be the same as normal multiplication. But IIRC, we added (perhaps in l3candidates? I'll check) a way for users to define their own fp functions. This is still experimental. Looking at it, it seems we don't document \fp_function:Nw and \fp_new_function:Npn anywhere. >> I'm keen on leaving juxtaposition = multiplication, because that >> allows to use dimensionful numbers directly inside fp expressions (pt, >> in, ... are defined as floating point constants). I believe that we >> should change the precedence of juxtaposition-as-multiplication from >> what it currently is (the tightest) to being the same as >> multiplication. In other words, juxtaposition would behave exactly >> identically to adding an asterisk. >> >> Would that make sense? Am I missing something crucial (probably... I >> didn't realize when allowing juxtaposition what a mess I was >> creating)? >> >> Best regards, >> Bruno > Thanks for the response Bruno (but "terrible" is a strong word). The > suggested new precedence would certainly take care of the examples that > tripped me up and that seemed like traps for the unwary. > > There is one other precedence which troubles me a little. I read an > expression like > > ln(1+1/n)^n > > as 'raise (1+1/n) to the n-th power then take the logarithm' ( = > n*ln(1+1/n) ). l3fp treats this as > > ( ln(1+1/n) )^n > > I realise that in the absence of clarifying parentheses there is an > inherent ambiguity in such forms which needs to be resolved in a fixed > manner one way or the other. I question whether l3fp has chosen the > intuitive way, or the way of customary practice. For instance we write > ("incorrectly" but the practice is universal) sin^2 x rather than sin > x^2 when we want to square the sine of x, presumably because sin x^2 > suggests the sine of x^2. In short, should the precedence levels of > function calls and raising to a power be interchanged? With your > proposed change to juxtaposition's precedence, this would bring l3fp > into line with customary "habits of mind".* > > Andrew > > * Well, my mind! No. All programming languages in which function arguments are surrounded with parentheses interpret ln(123)**2 as (ln(123))**2, so l3fp should as well. Now the question is how to implement the change in precedence in the least destructive way. I don't think we can have any warning (well... that's only mostly true, I have some very experimental code for ugly expandable warnings). Should we just do the change brutally? Regards, Bruno