LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
Date: Fri, 10 Mar 2017 21:21:29 -0800
MIME-version: 1.0 (Mac OS X Mail 9.3 \(3124\))
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
Content-type: text/plain; charset=utf-8
From: Christopher Rowley <[log in to unmask]>
In-Reply-To: <[log in to unmask]>
Message-ID: <[log in to unmask]>
Content-Transfer-Encoding: 8bit
Parts/Attachments: text/plain (44 lines)
sign may well be a useful function, but hardly much to do with fp.


> On 10 Mar 2017, at 16:49, Bruno Le Floch <[log in to unmask]> wrote:
> On 03/09/2017 05:42 PM, Andrew Parsloe wrote:
>> Two functions which I think could be beneficially added to l3fp without
>> straining its role as a kernel module (in the way that, say, the gamma
>> function would) are the signature function (sgn) and a unit step
>> function (Heaviside? -- the difficulty is what value to assign at 0).
>> Given the numerical values assigned to true and false in l3fp, it is
>> easy to mimic these with simple inequalities (e.g. (#1 > 0) - (#1 < 0)
>> for sgn) but perhaps the functions should be there in the first place?
>> I found myself wanting these when considering a table of fp values where
>> it made sense to blank cells containing negative values which "got in
>> the way". The code creating the table contained the option of blanking
>> zero-value cells, so I multiplied the tabulated formula by 1 - (#1 < 0).
>> Andrew
>> ---
>> This email has been checked for viruses by Avast antivirus software.
> Will copied your message to
> and replied there that
>> sign() or sgn() definitely makes sense to me, but I’m not sure about
>> step() / heaviside() / whatever. Can you give another example for the
>> use case there?
> I'm adding sign().  I don't think heaviside is needed: (#1) > 0 ? (#1) :
> 0 seems to do what you want pretty nicely.
> What do you think?
> Concerning Gamma, the main reason I haven't implemented it yet is that
> it requires determining some magic constants that were only given to me
> for a lower precision than what I need (10 digits instead of 16).
> Bruno