[J3] C TS 18661
Steven G. Kargl
kargl at troutmask.apl.washington.edu
Wed Jan 30 12:29:39 EST 2019
On Wed, Jan 30, 2019 at 11:09:39AM -0500, Steve Lionel via J3 wrote:
> On 1/30/2019 10:43 AM, Vipul Parekh via J3 wrote:
> >> acosd
> >> asind
> >> atand
> >> atan2d
> >> expm1
> >> logp1 (or log1p)
> >> rsqrt
> >> ..
> > Why not add all these to the Fortran standard? Why won't this be a no-brainer?
> >
> J3 already has the degree intrinsics on its list for the next standard
> (18-139r1, 18-272r1), largely due to their widespread existing
> implementation and use. A case for the other intrinsics mentioned would
> have to be made using different arguments. (I am not a mathematician,
> but I had never heard of expm1 or logp1, and don't recall a single
> request for rsqrt from a customer during my decades as a vendor. This is
> not an argument against them, just saying I'd want to see a stronger
> case than FOMO.)
>
What do you consider as convincing cases?
In time harmonic analysis, one often computes exp(cmplx(0.,tau)).
Many people, including me, do cmplx(cos(tau),sin(tau)). Thus,
cos() and sin() are computed in pairs, and the argument reduction
for large arguments (tau > pi/4) is performed twice. With
sincos() argument reduction is done once and the number of function
calls is cut in half. As I happen to be the person who wrote the
sincos() implementation that appears in FreeBSD's libm, I have timing
codes
Single precision, 100M calls for x in [0, 20000)
./testf -s -n 100 -m 0 -M 20000
100M sincosf calls in 4.235 seconds.
100M sinf and 100M cosf calls in 5.330 seconds.
Double precision, 100M calls for x in [0, 20000)
./testd -s -n 100 -m 0 -M 20000
100M sincos calls in 5.222 seconds.
100M sin and 100M cos calls in 8.105 seconds.
expm1(x) = exp(x) - 1 and is used for x near 1.
log1p(x) = log(1 + x) and is used for x near 0.
Both expm1 and log1p provided accurate results for the expressions
on the RHS whereas direct evaluation of the RHS suffer loss of
accuracy due to catatrophic cancellation. I'll point to papers
by PTP Tang for details.
PTP Tang, "Table-driven implementation of the expm1 function
in ieee floating-point arithmetic," ACM Trans. Math. Soft.,
vol. 18, 211-222 (1992).
PTP Tang, "Table-driven implementation of the logarithm function
in ieee floating-point arithmetic," ACM Trans. Math. Soft.,
vol. 16, 378-400 (1990).
Are there guidelines on the J3 website for writing a case paper?
--
Steve
More information about the J3
mailing list