Re: [xsl] Any difference between 1 div $x and math:pow($x, -1)?

Subject: Re: [xsl] Any difference between 1 div $x and math:pow($x, -1)?
From: "Norman Tovey-Walsh ndw@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 27 Jun 2020 14:09:11 -0000
Roger L Costello costello@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
writes:
> Hi Folks,
>
> My XSLT program computes this expression many times for different values of
$x:
>
> 1 div (1 + math:exp(-$x))
>
> Here is an equivalent expression:
>
> math:pow(1 + math:exp(-$x), -1)

As David points out, theybre not strictly equivalent.

> - produces more accurate results
> - is faster

The best way to answer those questions is to run some experiments.

> - is easier to understand, more intuitive

Thatbs going to depend on whobs looking at the code, I guess. If I think
about it, I can work out that math:pow($x, -1) is like 1/$x but this
many years removed from regular mathematical exercise, I have to think
about it for a moment.

                                        Be seeing you,
                                          norm

--
Norman Tovey-Walsh <ndw@xxxxxxxxxx>
https://nwalsh.com/

> Everything has been said before, but since nobody every listens we have
> to keep going back and beginning all over again.--AndrC) Gide

[demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc]

Current Thread