Roger L Costello costello(_at_)mitre(_dot_)org
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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, they’re 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
That’s going to depend on who’s 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(_at_)nwalsh(_dot_)com>
https://nwalsh.com/
Everything has been said before, but since nobody every listens we have
to keep going back and beginning all over again.--André Gide
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
signature.asc
Description: PGP signature