Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by h1439878.stratoserver.net (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id v3E2SxaA004242 for ; Fri, 14 Apr 2017 04:29:00 +0200 Received: from relay2.uni-heidelberg.de ([129.206.119.212]) by mx-ha.gmx.net (mxgmx006 [212.227.15.9]) with ESMTPS (Nemesis) id 0MZxuB-1clSQb0Wml-00Ljlc for ; Fri, 14 Apr 2017 04:28:54 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.15.2/8.15.2) with ESMTP id v3E2Snca018629; Fri, 14 Apr 2017 04:28:49 +0200 Received: from listserv (localhost [127.0.0.1]) by listserv.uni-heidelberg.de (Postfix) with ESMTP id 64B64126882; Fri, 14 Apr 2017 04:28:49 +0200 (CEST) Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 16479307 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 14 Apr 2017 04:28:49 +0200 Delivered-To: LATEX-L@listserv.uni-heidelberg.de Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.119.212]) by listserv.uni-heidelberg.de (Postfix) with ESMTP id 49632126389 for ; Fri, 14 Apr 2017 04:28:49 +0200 (CEST) Received: from mail-qk0-f173.google.com (mail-qk0-f173.google.com [209.85.220.173]) by relay2.uni-heidelberg.de (8.15.2/8.15.2) with ESMTPS id v3E2SiWO018594 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 14 Apr 2017 04:28:47 +0200 Received: by mail-qk0-f173.google.com with SMTP id d131so61337235qkc.3 for ; Thu, 13 Apr 2017 19:28:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=7zaD4N9nUINx6jhdJcN4dVTgiy63s04uFyNCGpH3Bnw=; b=eKdBQxfzKWSwGKLOjnJddZ8vW5L9oNR67RlPMuFgu2LrLXQ2qQtNbbE5TzeAl0O6NX 908c+kJZ3kFNh6TFqrKPUA0EVOqVyXCb7HR0zSu4BqRIZMGB2v6ocIlDy8KKEhgpsSIV d6FeNR4XyGMyDj8KuZ6turkhKnNe2w9whZwFqomZC5kMqqzJAvcehdAhnLgCWqUjHa4q LyxKs18WlOQyOt5AHaOvmfCxVspLnvJhCj7WweujjETt4AFiyZEciahzSYYOtgd7pOPw zyhoTCamfQ9ToURe4tLt8kE3SzTBoBAA5I/IMhLlg1P3o4KKHZlI6kG/MkPsY26pCBBF TZ5A== X-Gm-Message-State: AN3rC/7fwEifwRyma0bPYJSFf0KPcSdDtwvwqDHyAFN2aX74wOX57J5R OdAH2s2rZGNWJk0qPgM= X-Received: by 10.55.16.226 with SMTP id 95mr4887491qkq.171.1492136923795; Thu, 13 Apr 2017 19:28:43 -0700 (PDT) Received: from [192.168.1.76] (c-69-141-211-196.hsd1.nj.comcast.net. [69.141.211.196]) by smtp.gmail.com with ESMTPSA id l138sm424090qke.31.2017.04.13.19.28.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Apr 2017 19:28:43 -0700 (PDT) References: <58E07974.2090404@clear.net.nz> X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Message-ID: <332a169f-e924-44af-3325-f633d3065ad4@gmail.com> Date: Thu, 13 Apr 2017 22:28:42 -0400 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Bruno Le Floch Subject: Re: distinguishing -0 in l3fp To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <58E07974.2090404@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:rgDSeOw3kVo=:6Vxe7tv/tnjcK/YYNLiXoiMJBz kPImtKiALwCu7b1CIRZ8SUN0AR86lbtmT/6XUXzEMMMKDg4D+FaCNXkkxyLG+95zipvCvA2Sg LybuYf0apMVXN4bu59a/2jHPUvY1Lt0Zu10/c836oLbkwDDIFHHjxBkmHEqJiQysEZ+RuFBsL mLlNiYDKZe6Wm3QiRTtfZUgCHj3aVes5EWjA3fP6XH292DNE0VGD4tV/kZTUaBoz9dHLj1RBl ytz8rJwTRPK+1+ZdWzU3QhWb5oxWDOQR6N4fW8VE/aiZXYvaEfmg31OpvBYDHDlW9YXQYUWRo sFLYNCbcFc4ulgzoP4E4djs75cHDaM5l+NGXgMWqHMte2ee4keVNmlAFLb0Vubf0XmvQF/66W I9dMTTWNHd8muXRGnq4/tV24tTSt6IPt5OkXX6RZmHi7nocyLo3vXolKo9sqrQvGHlqPIaeJm FWLpw/gdOiQH5zBlXn1m4EPPnW9kkyG9/taSOfmHv5Lb4Hv0Dxatx3XLJG0HOnGqTD98wx9pC YXkeInmGPFdx8iwdemgq7o6Iq1IsyF3OX2Q3Mr81QAXCP7Q9WCzKUICfBV1myVFIDBspXWoKk 1mOJwdFIhzflHtqZYZpQkmLpJJAwwE8Ko2SOmF4oST4mSgztsepDwy4aeTc4jesyNpsHEtDdE 71O9mpBmRxkt3N75FVdNBa08Zn5ruvQ5AghTCH/FQyLOxGziuJW6/ljt7WEyS1ICF4CtYoqhb 64GhxeRJ0VZm4TmUEntxzPLBdFYZ8O48vZMAjqyrKhlRzY+XB6/BvSicgubgbvzTe1TpuZPSU bpS8EoFpAgmofj2eRJaQmIb1khVXvA7o6AHQIsuasdmArgD8IHy8A1C/0+SXf4pXgxMTldbDz 3ftGUS5YTZFlK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/ZlzlIqt3bFI+9V7ikozs6njBUUo9V0NAry7auNutbrC yqCQIyozXw/XA9mtONBCv0IP27531qSBujvIi+FUvErKKVfhxmXUMZDYyxDIUoQDl5eRvTr5i Mf24Z+6PTM92OQOp2bsRxBHq7ItYg1Blmd3AxgCxLThOxfTqW95tjES3W25XaEFR1DOPK8b81 HvKyR1kg+g== X-Scanned-By: MIMEDefang 2.71 on 85.214.41.38 Status: R X-Status: X-Keywords: X-UID: 7958 On 04/02/2017 12:09 AM, Andrew Parsloe wrote: > Is there a simple way to distinguish -0 from 0 in l3fp? > > I had been aligning left in a table a column of sines, +0 or -0 followed > by decimal point & digits. By adding an \hphantom{-} before the positive > numbers, they aligned nicely on the decimal point in the column, but > then along came -0. The simple conditional, "if !(number < 0) add > phantom", added the phantom and the column aligned like > 0 > 0.5878 > -0 > -0.5878 > etc. > In the absence of formatted printing of numbers, -0 is a problem. Even a > built-in test for -0 would ease matters, since in any kind of formatted > printing of numbers 0 and -0 will generally require different handling. > > As it is, I've had to test each fp for whether it is zero; if it is I > convert to a tl variable and test whether that is -0. This is clumsy. > Hence my opening question. > > Andrew Sorry for the delay. One option is to normalize -0 to +0 by adding +0. Namely, number+0 is equal to number for any non-zero number and is +0 for both +0 and -0. Another option is to compute 1/number after disabling the "division-by-zero" trap, and test whether that's +inf or -inf, but that's more complicated than the tl test you're doing. A better option is that I should add a "copysign" function, that is in the IEEE standard: copysign(1,x) gives +1 or -1 depending on the sign bit of x (so in particular this distinguishes +0 and -0). For your specific use case I would use \fp_to_tl:n then test whether the first character (\str_head:n) is "-" or not. This also covers nan properly. Bruno