Bug 216858 - C11 conformance: catanhl() is missing
Summary: C11 conformance: catanhl() is missing
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-standards (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-06 19:40 UTC by sgk
Modified: 2017-11-22 03:59 UTC (History)
3 users (show)

See Also:


Attachments
Diff for docs and mips fix (5.50 KB, text/plain)
2017-02-15 18:59 UTC, sgk
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description sgk 2017-02-06 19:40:24 UTC
#include <complex.h>
long double complex
foo(long double complex z)
{
   return (catanhl(z));
}
cc -c foo.c
foo.c:7:12: warning: implicitly declaring library function 'catanhl' with type
      '_Complex long double (_Complex long double)'
      [-Wimplicit-function-declaration]
   return (catanhl(z));
           ^
foo.c:7:12: note: include the header <complex.h> or explicitly provide a
      declaration for 'catanhl'
1 warning generated.
Comment 1 commit-hook freebsd_committer freebsd_triage 2017-02-15 08:01:11 UTC
A commit references this bug:

Author: mmokhi
Date: Wed Feb 15 07:59:55 UTC 2017
New revision: 313761
URL: https://svnweb.freebsd.org/changeset/base/313761

Log:
  Add casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
  to improve C11 conformance.

  PR:		216850 216851 216852 216856 216857 216858
  Submitted by:	mmokhi
  Reported by:	sgk@troutmask.apl.washington.edu
  Reviewed by:	bde, mat, theraven
  Approved by:	bde (src committer), mat (mentor)
  Differential Revision:	https://reviews.freebsd.org/D9491

Changes:
  head/lib/msun/Makefile
  head/lib/msun/Symbol.map
  head/lib/msun/src/catrigl.c
Comment 2 sgk 2017-02-15 16:45:18 UTC
(In reply to commit-hook from comment #1)

>  Reviewed by:	bde, mat, theraven
>  Approved by:	bde (src committer), mat (mentor)
>
> Changes:
>  head/lib/msun/Makefile
>  head/lib/msun/Symbol.map
>  head/lib/msun/src/catrigl.c

I am absolutely shocked that this commit was allowed.
Where is the documentation?  How did 3 reviewers miss
this?  Especially, given that at least one of the 
reviewers is a well respected contributor to FreeBSD.
Comment 3 David Chisnall freebsd_committer freebsd_triage 2017-02-15 16:58:32 UTC
I'm not sure why I was listed as a reviewer in the commit message.  My explicit comment to the author was that I am not qualified to review this patch.
Comment 4 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-02-15 17:05:20 UTC
(In reply to sgk from comment #2)
(In reply to David Chisnall from comment #3)
Sorry, I didn't listed theraven@ on appovers.
But my thought was because he is CC'ed on the review, I should list him.
Sorry again, if I did it wrong __/|\__

BTW, by docs you mean man pages? (if yes, I'm working to make them too, sorry for delay, but I'm not so good on man-writing and I need some helps :D)

Also, about code, as I told on review, I used stephen@'s codes as base of it.

Best regards,
Comment 5 sgk 2017-02-15 18:57:58 UTC
* Makefile:
  . Fix build on mips.
  . Add MLINKS for the long double inverse trignometric and
    hyperbolic functions

* man/cacos.3:
  . Document cacosl, cacoshl, casinl, casinhl, catanl, catanhl

* src/catrig.c:
  . Use weak references for LDBL_MANT_DIG == 53 targets.


Index: Makefile
===================================================================
--- Makefile	(revision 313777)
+++ Makefile	(working copy)
@@ -94,7 +94,8 @@
 COMMON_SRCS+=	s_copysignl.c s_fabsl.c s_llrintl.c s_lrintl.c s_modfl.c
 .if ${LDBL_PREC} != 53
 # If long double != double use these; otherwise, we alias the double versions.
-COMMON_SRCS+=	e_acoshl.c e_acosl.c e_asinl.c e_atan2l.c e_atanhl.c \
+COMMON_SRCS+=	catrigl.c \
+	e_acoshl.c e_acosl.c e_asinl.c e_atan2l.c e_atanhl.c \
 	e_coshl.c e_fmodl.c e_hypotl.c \
 	e_lgammal.c e_lgammal_r.c \
 	e_remainderl.c e_sinhl.c e_sqrtl.c \
@@ -107,7 +108,7 @@
 .endif
 
 # C99 complex functions
-COMMON_SRCS+=	catrig.c catrigf.c catrigl.c \
+COMMON_SRCS+=	catrig.c catrigf.c \
 	s_ccosh.c s_ccoshf.c s_cexp.c s_cexpf.c \
 	s_cimag.c s_cimagf.c s_cimagl.c \
 	s_conj.c s_conjf.c s_conjl.c \
@@ -147,9 +149,12 @@
 MLINKS+=atanh.3 atanhf.3 atanh.3 atanhl.3
 MLINKS+=atan2.3 atan2f.3 atan2.3 atan2l.3 \
 	atan2.3 carg.3 atan2.3 cargf.3 atan2.3 cargl.3
-MLINKS+=cacos.3 cacosf.3 cacos.3 cacosh.3 cacos.3 cacoshf.3 \
-	cacos.3 casin.3 cacos.3 casinf.3 cacos.3 casinh.3 cacos.3 casinhf.3 \
-	cacos.3 catan.3 cacos.3 catanf.3 cacos.3 catanh.3 cacos.3 catanhf.3
+MLINKS+=cacos.3 cacosf.3 cacos.3 cacosl.3 \
+	cacos.3 cacosh.3 cacos.3 cacoshf.3 cacos.3 cacoshl.3 \
+	cacos.3 casin.3 cacos.3 casinf.3 cacos.3 casinl.3 \
+	cacos.3 casinh.3 cacos.3 casinhf.3 cacos.3 casinhl.3 \
+	cacos.3 catan.3 cacos.3 catanf.3 cacos.3 catanl.3 \
+	cacos.3 catanh.3 cacos.3 catanhf.3 cacos.3 catanhl.3
 MLINKS+=ccos.3 ccosf.3 ccos.3 csin.3 ccos.3 csinf.3 ccos.3 ctan.3 ccos.3 ctanf.3
 MLINKS+=ccosh.3 ccoshf.3 ccosh.3 csinh.3 ccosh.3 csinhf.3 \
 	ccosh.3 ctanh.3 ccosh.3 ctanhf.3
Index: man/cacos.3
===================================================================
--- man/cacos.3	(revision 313777)
+++ man/cacos.3	(working copy)
@@ -24,23 +24,29 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Jul 14, 2015
+.Dd February 15, 2017
 .Dt CACOS 3
 .Os
 .Sh NAME
 .Nm cacos ,
 .Nm cacosf ,
+.Nm cacosl ,
 .Nm cacosh ,
 .Nm cacoshf ,
+.Nm cacoshl ,
 .Nm casin ,
-.Nm casinf
+.Nm casinf ,
+.Nm casinl ,
 .Nm casinh ,
-.Nm casinhf
-.Nm catan ,
-.Nm catanf
+.Nm casinhf ,
+.Nm casinhl ,
+.Nm catan  ,
+.Nm catanf ,
+.Nm catanl ,
 .Nm catanh ,
-.Nm catanhf
-.Nd complex arc trigonometric and hyperbolic functions
+.Nm catanhf ,
+.Nm catanhl
+.Nd complex inverse trigonometric and hyperbolic functions
 .Sh LIBRARY
 .Lb libm
 .Sh SYNOPSIS
@@ -49,26 +55,39 @@
 .Fn cacos "double complex z"
 .Ft float complex
 .Fn cacosf "float complex z"
+.Ft long double complex
+.Fn cacosl "long double complex z"
 .Ft double complex
 .Fn cacosh "double complex z"
 .Ft float complex
 .Fn cacoshf "float complex z"
+.Ft long double complex
+.Fn cacoshl "long double complex z"
 .Ft double complex
 .Fn casin "double complex z"
 .Ft float complex
 .Fn casinf "float complex z"
+.Ft long double complex
+.Fn casinl "long double complex z"
 .Ft double complex
 .Fn casinh "double complex z"
 .Ft float complex
 .Fn casinhf "float complex z"
+.Ft long double complex
+.Fn casinhl "long double complex z"
 .Ft double complex
 .Fn catan "double complex z"
 .Ft float complex
 .Fn catanf "float complex z"
+.Ft long double complex
+.Fn catanl "long double complex z"
 .Ft double complex
 .Fn catanh "double complex z"
 .Ft float complex
 .Fn catanhf "float complex z"
+.Ft long double complex
+.Fn catanhl "long double complex z"
+
 .Sh DESCRIPTION
 The
 .Fn cacos ,
@@ -97,10 +116,23 @@
 functions perform the same operations in
 .Fa float
 precision.
+The
+.Fn cacosl ,
+.Fn casinl ,
+.Fn catanl
+.Fn cacoshl ,
+.Fn casinhl ,
+and
+.Fn catanhl
+functions perform the same operations in
+.Fa long double
+precision.
+
 .Pp
 .ds Un \[cu]
 There is no universal convention for defining the principal values of
-these functions. The following table gives the branch cuts, and the
+these functions.
+The following table gives the branch cuts, and the
 corresponding ranges for the return values, adopted by the C language.
 .Bl -column ".Sy Function" ".Sy (-\*(If*I, -I) \*(Un (I, \*(If*I)" ".Sy [-\*(Pi/2*I, \*(Pi/2*I]"
 .It Sy Function Ta Sy Branch Cut(s) Ta Sy Range
Index: src/catrig.c
===================================================================
--- src/catrig.c	(revision 313777)
+++ src/catrig.c	(working copy)
@@ -328,6 +328,10 @@
 	return (CMPLX(copysign(rx, x), copysign(ry, y)));
 }
 
+#if (LDBL_MANT_DIG == 53)
+__weak_reference(casinh, casinhl);
+#endif
+
 /*
  * casin(z) = reverse(casinh(reverse(z)))
  * where reverse(x + I*y) = y + I*x = I*conj(z).
@@ -340,6 +344,10 @@
 	return (CMPLX(cimag(w), creal(w)));
 }
 
+#if (LDBL_MANT_DIG == 53)
+__weak_reference(casin, casinl);
+#endif
+
 /*
  * cacos(z) = PI/2 - casin(z)
  * but do the computation carefully so cacos(z) is accurate when z is
@@ -422,6 +430,10 @@
 	return (CMPLX(rx, ry));
 }
 
+#if (LDBL_MANT_DIG == 53)
+__weak_reference(cacos, cacosl);
+#endif
+
 /*
  * cacosh(z) = I*cacos(z) or -I*cacos(z)
  * where the sign is chosen so Re(cacosh(z)) >= 0.
@@ -448,6 +460,10 @@
 	return (CMPLX(fabs(ry), copysign(rx, cimag(z))));
 }
 
+#if (LDBL_MANT_DIG == 53)
+__weak_reference(cacosh, cacoshl);
+#endif
+
 /*
  * Optimized version of clog() for |z| finite and larger than ~RECIP_EPSILON.
  */
@@ -626,6 +642,10 @@
 	return (CMPLX(copysign(rx, x), copysign(ry, y)));
 }
 
+#if (LDBL_MANT_DIG == 53)
+__weak_reference(catanh, catanhl);
+#endif
+
 /*
  * catan(z) = reverse(catanh(reverse(z)))
  * where reverse(x + I*y) = y + I*x = I*conj(z).
@@ -637,3 +657,7 @@
 
 	return (CMPLX(cimag(w), creal(w)));
 }
+
+#if (LDBL_MANT_DIG == 53)
+__weak_reference(catan, catanl);
+#endif
Comment 6 sgk 2017-02-15 18:59:51 UTC
Created attachment 180025 [details]
Diff for docs and mips fix

Attached path in case bugzilla munched the formatting in the email
Comment 7 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-02-15 21:22:43 UTC
(In reply to sgk from comment #5)
Thanks for the patch, actually I had some parts of it on my review (https://reviews.freebsd.org/D9491) waiting for bde@'s comment (via email).
I didn't have man part on the review yet, so I'll merge yours with mine :)
Feel free to check my review, and comment on it, I appreciate it.

Best regards,
Comment 8 sgk 2017-02-15 22:01:31 UTC
(In reply to Mahdi Mokhtari from comment #7)
I don't have an account on reviews.freebsd.org, so can't 
review anything for you.  I also find it rather sad that
the emails sent by FreeBSD's bugzilla has NO-REPLY set,
which makes it enormously painful to even response to 
your here.
Comment 9 Mathieu Arnold freebsd_committer freebsd_triage 2017-02-15 22:15:11 UTC
(In reply to sgk from comment #2)
> (In reply to commit-hook from comment #1)
> 
> >  Reviewed by:	bde, mat, theraven
> >  Approved by:	bde (src committer), mat (mentor)
> >
> > Changes:
> >  head/lib/msun/Makefile
> >  head/lib/msun/Symbol.map
> >  head/lib/msun/src/catrigl.c
> 
> I am absolutely shocked that this commit was allowed.
> Where is the documentation?  How did 3 reviewers miss
> this?  Especially, given that at least one of the 
> reviewers is a well respected contributor to FreeBSD.

My only review was to say "go find a src committer to approve it", I have no idea of what this does.
Comment 10 commit-hook freebsd_committer freebsd_triage 2017-02-17 08:23:40 UTC
A commit references this bug:

Author: mmokhi
Date: Fri Feb 17 08:22:33 UTC 2017
New revision: 313863
URL: https://svnweb.freebsd.org/changeset/base/313863

Log:
  Fix building of r313761 on platforms that
  `long double` is alias of `double` (MIPS, etc)

  PR:		216850 216851 216852 216856 216857 216858
  Reported by:	emsate
  Reviewed by:	bde emaste hselasky
  Approved by:	bde emaste hselasky
  Differential Revision:	https://reviews.freebsd.org/D9491

Changes:
  head/lib/msun/Makefile
  head/lib/msun/src/catrig.c
Comment 11 commit-hook freebsd_committer freebsd_triage 2017-02-17 08:26:53 UTC
A commit references this bug:

Author: mmokhi
Date: Fri Feb 17 08:25:48 UTC 2017
New revision: 313864
URL: https://svnweb.freebsd.org/changeset/base/313864

Log:
  Add documentations related to new APIs of r313761

  PR:		216850 216851 216852 216856 216857 216858
  Submitted by:	sgk@troutmask.apl.washington.edu
  Reported by:	sgk@troutmask.apl.washington.edu
  Reviewed by:	bde emaste hselasky
  Approved by:	bde emaste hselasky
  Differential Revision:	https://reviews.freebsd.org/D9491

Changes:
  head/lib/msun/man/cacos.3
Comment 12 commit-hook freebsd_committer freebsd_triage 2017-09-26 09:03:13 UTC
A commit references this bug:

Author: dim
Date: Tue Sep 26 09:01:58 UTC 2017
New revision: 324006
URL: https://svnweb.freebsd.org/changeset/base/324006

Log:
  Synchronize most of libm with head as of r323004.  This excludes a few
  arch-specific updates for powerpcspe, mips and riscv, for which support
  has not been merged yet.

  Bump __FreeBSD_version for the addition of cacoshl, cacosl, casinhl,
  casinl, catanl, catanhl, sincos, sincosf, and sincosl.

  MFC r305382 (by bde):

    Add asm versions of fmod(), fmodf() and fmodl() on amd64.  Add asm
    versions of fmodf() amd fmodl() on i387.

    fmod is similar to remainder, and the C versions are 3 to 9 times
    slower than the asm versions on x86 for both, but we had the strange
    mixture of all 6 variants of remainder in asm and only 1 of 6
    variants of fmod in asm.

  MFC r305384 (by bde):

    Disconnect the "optimized" asm variants of cos(), sin() and tan() from
    the build on i386.  Leave them in the source tree for regression tests.

    The asm functions were always much less accurate (by a factor of more
    than 10**18 in the worst case).  They were faster on old CPUs.  But
    with each new generation of CPUs they get relatively slower.  The
    double precision C version's average advantage is about a factor of 2
    on Haswell.

    The asm functions were already intentionally avoided in float and long
    double precision on i386 and in all precisions on amd64.  Float
    precision and amd64 give larger advantages to the C version.  The long
    double precision C code and compilers' understanding of long double
    precision are not so good, so the i387 is still slightly faster for
    long double precision, except for the unimportant subcase of huge args
    where the sub-optimal C code now somehow beats the i387 by about a
    factor of 2.

  MFC r305385 (by bde):

    Oops, the previous i386 version of e_fmodf.S and e_fmodl.S was
    actually the amd64 version.

  MFC r306409 (by emaste):

    libm: fix some unused variable (rcsid) and dangling else warnings

    s_{fabs,fmax,logb,scalb}{,f,l}.c may be built elsewhere with a higher
    WARNS setting.

    Reviewed by:	ed
    Sponsored by:	The FreeBSD Foundation
    Differential Revision:	https://reviews.freebsd.org/D8061

  MFC r306410 (by emaste):

    libm: simplify i387 subdir logic with make's :S substitution

  MFC r306527 (by emaste):

    libm: remove unused variables for LDBL_MANT_DIG != 113

    Sponsored by:	The FreeBSD Foundation

  MFC r306709 (by emaste):

    libm: remove unused variables

    Sponsored by:	The FreeBSD Foundation

  MFC r307066 (by br):

    Don't use fmaxl/fminl on platforms with no long double support,
    use fmax/fmin instead.

    This fixes fmaxmin test failure on MIPS64.

    Reviewed by:	emaste
    Sponsored by:	DARPA, AFRL
    Sponsored by:	HEIF5
    Differential Revision:	https://reviews.freebsd.org/D8216

  MFC r308172 (by emaste):

    libm: add braces around initialization of subobjects

    This cleans up a warning when building libm at higher WARNS levels and
    makes the intent more clear. By the C standard the values are assigned
    to subobject members in order so this change introduces no functional
    change. (6.7.9 20)

    Reviewed by:	kib
    Sponsored by:	The FreeBSD Foundation
    Differential Revision:	https://reviews.freebsd.org/D8333

  MFC r313761 (by mmokhi):

    Add casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
    to improve C11 conformance.

    PR:		216850 216851 216852 216856 216857 216858
    Submitted by:	mmokhi
    Reported by:	sgk@troutmask.apl.washington.edu
    Reviewed by:	bde, mat, theraven
    Approved by:	bde (src committer), mat (mentor)
    Differential Revision:	https://reviews.freebsd.org/D9491

  MFC r313863 (by mmokhi):

    Fix building of r313761 on platforms that
    `long double` is alias of `double` (MIPS, etc)

    PR:		216850 216851 216852 216856 216857 216858
    Reported by:	emsate
    Reviewed by:	bde emaste hselasky
    Approved by:	bde emaste hselasky
    Differential Revision:	https://reviews.freebsd.org/D9491

  MFC r313864 (by mmokhi):

    Add documentations related to new APIs of r313761

    PR:		216850 216851 216852 216856 216857 216858
    Submitted by:	sgk@troutmask.apl.washington.edu
    Reported by:	sgk@troutmask.apl.washington.edu
    Reviewed by:	bde emaste hselasky
    Approved by:	bde emaste hselasky
    Differential Revision:	https://reviews.freebsd.org/D9491

  MFC r314950 (by ngie):

    Don't expect :test_large_inputs to fail with i386 anymore

    Recent changes (maybe a side-effect of the ATF-ification in r314649)
    invalidate the failure expectation.

    PR:		205446
    Sponsored by:	Dell EMC Isilon

  MFC r317349 (by pfg):

    msun: Remove trailing space in Sunsoft copyright statement.

    Submittedby:	kargl

  MFC r319047 (by mmel):

    Implement sincos, sincosf, and sincosl.
    The primary benefit of these functions is that argument
    reduction is done once instead of twice in independent
    calls to sin() and cos().

    * lib/msun/Makefile:
      . Add s_sincos[fl].c to the build.
      . Add sincos.3 documentation.
      . Add appropriate MLINKS.

    * lib/msun/Symbol.map:
      . Expose sincos[fl] symbols in dynamic libm.so.

    * lib/msun/man/sincos.3:
      . Documentation for sincos[fl].

    * lib/msun/src/k_sincos.h:
      . Kernel for sincos() function.  This merges the individual kernels
        for sin() and cos().  The merger offered an opportunity to re-arrange
        the individual kernels for better performance.

    * lib/msun/src/k_sincosf.h:
       . Kernel for sincosf() function.  This merges the individual kernels
         for sinf() and cosf(). The merger offered an opportunity to re-arrange
         the individual kernels for better performance.

    * lib/msun/src/k_sincosl.h:
       . Kernel for sincosl() function.  This merges the individual kernels
         for sinl() and cosl(). The merger offered an opportunity to re-arrange
         the individual kernels for better performance.

    * lib/msun/src/math.h:
      . Add prototytpes for sincos[fl]().

    * lib/msun/src/math_private.h:
      . Add RETURNV macros.  This is needed to reset fpsetprec on I386
        hardware for a function with type void.

    * lib/msun/src/s_sincos.c:
      . Implementation of sincos() where sin() and cos() were merged into
        one routine and possibly re-arranged for better performance.

    * lib/msun/src/s_sincosf.c:
      . Implementation of sincosf() where sinf() and cosf() were merged into
        one routine and possibly re-arranged for better performance.

    * lib/msun/src/s_sincosl.c:
      . Implementation of sincosl() where sinl() and cosl() were merged into
        one routine and possibly re-arranged for better performance.

    PR:		215977, 218300
    Submitted by:	Steven G. Kargl <sgk@troutmask.apl.washington.edu>
    Differential Revision:	https://reviews.freebsd.org/D10765

  MFC r321457 (by ngie):

    Mark :reduction as an expected failure

    It fails with clang 5.0+.

    PR:	220989
    Reported by:	Jenkins

  MFC r322418 (by rlibby):

    lib/msun: avoid referring to broken LDBL_MAX

    LDBL_MAX is broken on i386:
    https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html

    Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
    for some time, and newer versions of gcc are now warning that the
    "floating constant exceeds range of 'long double'".  Avoid this by
    referring to half the value of LDBL_MAX instead.

    Reviewed by:	bde
    Approved by:	markj (mentor)
    Sponsored by:	Dell EMC Isilon

  MFC r322435 (by rlibby):

    Revert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches

    Either need a different way to spell HALF_LDBL_MAX, or a different way
    to spell LDBL_MAX_EXP, or a different approach.

    Reported by:	ian

  MFC r322921 (by ngie):

    Revert r321457

    It doesn't fail after ^/head@r322855 (the releng_50 clang merge).

    PR:	220989

Changes:
_U  stable/11/
  stable/11/lib/msun/Makefile
  stable/11/lib/msun/Symbol.map
  stable/11/lib/msun/amd64/Makefile.inc
  stable/11/lib/msun/amd64/e_fmod.S
  stable/11/lib/msun/amd64/e_fmodf.S
  stable/11/lib/msun/amd64/e_fmodl.S
  stable/11/lib/msun/i387/Makefile.inc
  stable/11/lib/msun/i387/e_fmodf.S
  stable/11/lib/msun/i387/e_fmodl.S
  stable/11/lib/msun/ld80/e_lgammal_r.c
  stable/11/lib/msun/ld80/k_expl.h
  stable/11/lib/msun/ld80/s_logl.c
  stable/11/lib/msun/man/cacos.3
  stable/11/lib/msun/man/sincos.3
  stable/11/lib/msun/src/catrig.c
  stable/11/lib/msun/src/catrigl.c
  stable/11/lib/msun/src/e_asin.c
  stable/11/lib/msun/src/e_coshl.c
  stable/11/lib/msun/src/e_lgammaf_r.c
  stable/11/lib/msun/src/e_sinhl.c
  stable/11/lib/msun/src/k_sincos.h
  stable/11/lib/msun/src/k_sincosf.h
  stable/11/lib/msun/src/k_sincosl.h
  stable/11/lib/msun/src/math.h
  stable/11/lib/msun/src/math_private.h
  stable/11/lib/msun/src/s_fabs.c
  stable/11/lib/msun/src/s_fmax.c
  stable/11/lib/msun/src/s_fmin.c
  stable/11/lib/msun/src/s_logbl.c
  stable/11/lib/msun/src/s_scalbn.c
  stable/11/lib/msun/src/s_scalbnf.c
  stable/11/lib/msun/src/s_scalbnl.c
  stable/11/lib/msun/src/s_sincos.c
  stable/11/lib/msun/src/s_sincosf.c
  stable/11/lib/msun/src/s_sincosl.c
  stable/11/lib/msun/src/s_tanhl.c
  stable/11/lib/msun/tests/ctrig_test.c
  stable/11/sys/sys/param.h
Comment 13 commit-hook freebsd_committer freebsd_triage 2017-09-26 09:03:15 UTC
A commit references this bug:

Author: dim
Date: Tue Sep 26 09:01:59 UTC 2017
New revision: 324006
URL: https://svnweb.freebsd.org/changeset/base/324006

Log:
  Synchronize most of libm with head as of r323004.  This excludes a few
  arch-specific updates for powerpcspe, mips and riscv, for which support
  has not been merged yet.

  Bump __FreeBSD_version for the addition of cacoshl, cacosl, casinhl,
  casinl, catanl, catanhl, sincos, sincosf, and sincosl.

  MFC r305382 (by bde):

    Add asm versions of fmod(), fmodf() and fmodl() on amd64.  Add asm
    versions of fmodf() amd fmodl() on i387.

    fmod is similar to remainder, and the C versions are 3 to 9 times
    slower than the asm versions on x86 for both, but we had the strange
    mixture of all 6 variants of remainder in asm and only 1 of 6
    variants of fmod in asm.

  MFC r305384 (by bde):

    Disconnect the "optimized" asm variants of cos(), sin() and tan() from
    the build on i386.  Leave them in the source tree for regression tests.

    The asm functions were always much less accurate (by a factor of more
    than 10**18 in the worst case).  They were faster on old CPUs.  But
    with each new generation of CPUs they get relatively slower.  The
    double precision C version's average advantage is about a factor of 2
    on Haswell.

    The asm functions were already intentionally avoided in float and long
    double precision on i386 and in all precisions on amd64.  Float
    precision and amd64 give larger advantages to the C version.  The long
    double precision C code and compilers' understanding of long double
    precision are not so good, so the i387 is still slightly faster for
    long double precision, except for the unimportant subcase of huge args
    where the sub-optimal C code now somehow beats the i387 by about a
    factor of 2.

  MFC r305385 (by bde):

    Oops, the previous i386 version of e_fmodf.S and e_fmodl.S was
    actually the amd64 version.

  MFC r306409 (by emaste):

    libm: fix some unused variable (rcsid) and dangling else warnings

    s_{fabs,fmax,logb,scalb}{,f,l}.c may be built elsewhere with a higher
    WARNS setting.

    Reviewed by:	ed
    Sponsored by:	The FreeBSD Foundation
    Differential Revision:	https://reviews.freebsd.org/D8061

  MFC r306410 (by emaste):

    libm: simplify i387 subdir logic with make's :S substitution

  MFC r306527 (by emaste):

    libm: remove unused variables for LDBL_MANT_DIG != 113

    Sponsored by:	The FreeBSD Foundation

  MFC r306709 (by emaste):

    libm: remove unused variables

    Sponsored by:	The FreeBSD Foundation

  MFC r307066 (by br):

    Don't use fmaxl/fminl on platforms with no long double support,
    use fmax/fmin instead.

    This fixes fmaxmin test failure on MIPS64.

    Reviewed by:	emaste
    Sponsored by:	DARPA, AFRL
    Sponsored by:	HEIF5
    Differential Revision:	https://reviews.freebsd.org/D8216

  MFC r308172 (by emaste):

    libm: add braces around initialization of subobjects

    This cleans up a warning when building libm at higher WARNS levels and
    makes the intent more clear. By the C standard the values are assigned
    to subobject members in order so this change introduces no functional
    change. (6.7.9 20)

    Reviewed by:	kib
    Sponsored by:	The FreeBSD Foundation
    Differential Revision:	https://reviews.freebsd.org/D8333

  MFC r313761 (by mmokhi):

    Add casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
    to improve C11 conformance.

    PR:		216850 216851 216852 216856 216857 216858
    Submitted by:	mmokhi
    Reported by:	sgk@troutmask.apl.washington.edu
    Reviewed by:	bde, mat, theraven
    Approved by:	bde (src committer), mat (mentor)
    Differential Revision:	https://reviews.freebsd.org/D9491

  MFC r313863 (by mmokhi):

    Fix building of r313761 on platforms that
    `long double` is alias of `double` (MIPS, etc)

    PR:		216850 216851 216852 216856 216857 216858
    Reported by:	emsate
    Reviewed by:	bde emaste hselasky
    Approved by:	bde emaste hselasky
    Differential Revision:	https://reviews.freebsd.org/D9491

  MFC r313864 (by mmokhi):

    Add documentations related to new APIs of r313761

    PR:		216850 216851 216852 216856 216857 216858
    Submitted by:	sgk@troutmask.apl.washington.edu
    Reported by:	sgk@troutmask.apl.washington.edu
    Reviewed by:	bde emaste hselasky
    Approved by:	bde emaste hselasky
    Differential Revision:	https://reviews.freebsd.org/D9491

  MFC r314950 (by ngie):

    Don't expect :test_large_inputs to fail with i386 anymore

    Recent changes (maybe a side-effect of the ATF-ification in r314649)
    invalidate the failure expectation.

    PR:		205446
    Sponsored by:	Dell EMC Isilon

  MFC r317349 (by pfg):

    msun: Remove trailing space in Sunsoft copyright statement.

    Submittedby:	kargl

  MFC r319047 (by mmel):

    Implement sincos, sincosf, and sincosl.
    The primary benefit of these functions is that argument
    reduction is done once instead of twice in independent
    calls to sin() and cos().

    * lib/msun/Makefile:
      . Add s_sincos[fl].c to the build.
      . Add sincos.3 documentation.
      . Add appropriate MLINKS.

    * lib/msun/Symbol.map:
      . Expose sincos[fl] symbols in dynamic libm.so.

    * lib/msun/man/sincos.3:
      . Documentation for sincos[fl].

    * lib/msun/src/k_sincos.h:
      . Kernel for sincos() function.  This merges the individual kernels
        for sin() and cos().  The merger offered an opportunity to re-arrange
        the individual kernels for better performance.

    * lib/msun/src/k_sincosf.h:
       . Kernel for sincosf() function.  This merges the individual kernels
         for sinf() and cosf(). The merger offered an opportunity to re-arrange
         the individual kernels for better performance.

    * lib/msun/src/k_sincosl.h:
       . Kernel for sincosl() function.  This merges the individual kernels
         for sinl() and cosl(). The merger offered an opportunity to re-arrange
         the individual kernels for better performance.

    * lib/msun/src/math.h:
      . Add prototytpes for sincos[fl]().

    * lib/msun/src/math_private.h:
      . Add RETURNV macros.  This is needed to reset fpsetprec on I386
        hardware for a function with type void.

    * lib/msun/src/s_sincos.c:
      . Implementation of sincos() where sin() and cos() were merged into
        one routine and possibly re-arranged for better performance.

    * lib/msun/src/s_sincosf.c:
      . Implementation of sincosf() where sinf() and cosf() were merged into
        one routine and possibly re-arranged for better performance.

    * lib/msun/src/s_sincosl.c:
      . Implementation of sincosl() where sinl() and cosl() were merged into
        one routine and possibly re-arranged for better performance.

    PR:		215977, 218300
    Submitted by:	Steven G. Kargl <sgk@troutmask.apl.washington.edu>
    Differential Revision:	https://reviews.freebsd.org/D10765

  MFC r321457 (by ngie):

    Mark :reduction as an expected failure

    It fails with clang 5.0+.

    PR:	220989
    Reported by:	Jenkins

  MFC r322418 (by rlibby):

    lib/msun: avoid referring to broken LDBL_MAX

    LDBL_MAX is broken on i386:
    https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html

    Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
    for some time, and newer versions of gcc are now warning that the
    "floating constant exceeds range of 'long double'".  Avoid this by
    referring to half the value of LDBL_MAX instead.

    Reviewed by:	bde
    Approved by:	markj (mentor)
    Sponsored by:	Dell EMC Isilon

  MFC r322435 (by rlibby):

    Revert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches

    Either need a different way to spell HALF_LDBL_MAX, or a different way
    to spell LDBL_MAX_EXP, or a different approach.

    Reported by:	ian

  MFC r322921 (by ngie):

    Revert r321457

    It doesn't fail after ^/head@r322855 (the releng_50 clang merge).

    PR:	220989

Changes:
_U  stable/11/
  stable/11/lib/msun/Makefile
  stable/11/lib/msun/Symbol.map
  stable/11/lib/msun/amd64/Makefile.inc
  stable/11/lib/msun/amd64/e_fmod.S
  stable/11/lib/msun/amd64/e_fmodf.S
  stable/11/lib/msun/amd64/e_fmodl.S
  stable/11/lib/msun/i387/Makefile.inc
  stable/11/lib/msun/i387/e_fmodf.S
  stable/11/lib/msun/i387/e_fmodl.S
  stable/11/lib/msun/ld80/e_lgammal_r.c
  stable/11/lib/msun/ld80/k_expl.h
  stable/11/lib/msun/ld80/s_logl.c
  stable/11/lib/msun/man/cacos.3
  stable/11/lib/msun/man/sincos.3
  stable/11/lib/msun/src/catrig.c
  stable/11/lib/msun/src/catrigl.c
  stable/11/lib/msun/src/e_asin.c
  stable/11/lib/msun/src/e_coshl.c
  stable/11/lib/msun/src/e_lgammaf_r.c
  stable/11/lib/msun/src/e_sinhl.c
  stable/11/lib/msun/src/k_sincos.h
  stable/11/lib/msun/src/k_sincosf.h
  stable/11/lib/msun/src/k_sincosl.h
  stable/11/lib/msun/src/math.h
  stable/11/lib/msun/src/math_private.h
  stable/11/lib/msun/src/s_fabs.c
  stable/11/lib/msun/src/s_fmax.c
  stable/11/lib/msun/src/s_fmin.c
  stable/11/lib/msun/src/s_logbl.c
  stable/11/lib/msun/src/s_scalbn.c
  stable/11/lib/msun/src/s_scalbnf.c
  stable/11/lib/msun/src/s_scalbnl.c
  stable/11/lib/msun/src/s_sincos.c
  stable/11/lib/msun/src/s_sincosf.c
  stable/11/lib/msun/src/s_sincosl.c
  stable/11/lib/msun/src/s_tanhl.c
  stable/11/lib/msun/tests/ctrig_test.c
  stable/11/sys/sys/param.h
Comment 14 commit-hook freebsd_committer freebsd_triage 2017-09-26 09:03:19 UTC
A commit references this bug:

Author: dim
Date: Tue Sep 26 09:01:59 UTC 2017
New revision: 324006
URL: https://svnweb.freebsd.org/changeset/base/324006

Log:
  Synchronize most of libm with head as of r323004.  This excludes a few
  arch-specific updates for powerpcspe, mips and riscv, for which support
  has not been merged yet.

  Bump __FreeBSD_version for the addition of cacoshl, cacosl, casinhl,
  casinl, catanl, catanhl, sincos, sincosf, and sincosl.

  MFC r305382 (by bde):

    Add asm versions of fmod(), fmodf() and fmodl() on amd64.  Add asm
    versions of fmodf() amd fmodl() on i387.

    fmod is similar to remainder, and the C versions are 3 to 9 times
    slower than the asm versions on x86 for both, but we had the strange
    mixture of all 6 variants of remainder in asm and only 1 of 6
    variants of fmod in asm.

  MFC r305384 (by bde):

    Disconnect the "optimized" asm variants of cos(), sin() and tan() from
    the build on i386.  Leave them in the source tree for regression tests.

    The asm functions were always much less accurate (by a factor of more
    than 10**18 in the worst case).  They were faster on old CPUs.  But
    with each new generation of CPUs they get relatively slower.  The
    double precision C version's average advantage is about a factor of 2
    on Haswell.

    The asm functions were already intentionally avoided in float and long
    double precision on i386 and in all precisions on amd64.  Float
    precision and amd64 give larger advantages to the C version.  The long
    double precision C code and compilers' understanding of long double
    precision are not so good, so the i387 is still slightly faster for
    long double precision, except for the unimportant subcase of huge args
    where the sub-optimal C code now somehow beats the i387 by about a
    factor of 2.

  MFC r305385 (by bde):

    Oops, the previous i386 version of e_fmodf.S and e_fmodl.S was
    actually the amd64 version.

  MFC r306409 (by emaste):

    libm: fix some unused variable (rcsid) and dangling else warnings

    s_{fabs,fmax,logb,scalb}{,f,l}.c may be built elsewhere with a higher
    WARNS setting.

    Reviewed by:	ed
    Sponsored by:	The FreeBSD Foundation
    Differential Revision:	https://reviews.freebsd.org/D8061

  MFC r306410 (by emaste):

    libm: simplify i387 subdir logic with make's :S substitution

  MFC r306527 (by emaste):

    libm: remove unused variables for LDBL_MANT_DIG != 113

    Sponsored by:	The FreeBSD Foundation

  MFC r306709 (by emaste):

    libm: remove unused variables

    Sponsored by:	The FreeBSD Foundation

  MFC r307066 (by br):

    Don't use fmaxl/fminl on platforms with no long double support,
    use fmax/fmin instead.

    This fixes fmaxmin test failure on MIPS64.

    Reviewed by:	emaste
    Sponsored by:	DARPA, AFRL
    Sponsored by:	HEIF5
    Differential Revision:	https://reviews.freebsd.org/D8216

  MFC r308172 (by emaste):

    libm: add braces around initialization of subobjects

    This cleans up a warning when building libm at higher WARNS levels and
    makes the intent more clear. By the C standard the values are assigned
    to subobject members in order so this change introduces no functional
    change. (6.7.9 20)

    Reviewed by:	kib
    Sponsored by:	The FreeBSD Foundation
    Differential Revision:	https://reviews.freebsd.org/D8333

  MFC r313761 (by mmokhi):

    Add casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
    to improve C11 conformance.

    PR:		216850 216851 216852 216856 216857 216858
    Submitted by:	mmokhi
    Reported by:	sgk@troutmask.apl.washington.edu
    Reviewed by:	bde, mat, theraven
    Approved by:	bde (src committer), mat (mentor)
    Differential Revision:	https://reviews.freebsd.org/D9491

  MFC r313863 (by mmokhi):

    Fix building of r313761 on platforms that
    `long double` is alias of `double` (MIPS, etc)

    PR:		216850 216851 216852 216856 216857 216858
    Reported by:	emsate
    Reviewed by:	bde emaste hselasky
    Approved by:	bde emaste hselasky
    Differential Revision:	https://reviews.freebsd.org/D9491

  MFC r313864 (by mmokhi):

    Add documentations related to new APIs of r313761

    PR:		216850 216851 216852 216856 216857 216858
    Submitted by:	sgk@troutmask.apl.washington.edu
    Reported by:	sgk@troutmask.apl.washington.edu
    Reviewed by:	bde emaste hselasky
    Approved by:	bde emaste hselasky
    Differential Revision:	https://reviews.freebsd.org/D9491

  MFC r314950 (by ngie):

    Don't expect :test_large_inputs to fail with i386 anymore

    Recent changes (maybe a side-effect of the ATF-ification in r314649)
    invalidate the failure expectation.

    PR:		205446
    Sponsored by:	Dell EMC Isilon

  MFC r317349 (by pfg):

    msun: Remove trailing space in Sunsoft copyright statement.

    Submittedby:	kargl

  MFC r319047 (by mmel):

    Implement sincos, sincosf, and sincosl.
    The primary benefit of these functions is that argument
    reduction is done once instead of twice in independent
    calls to sin() and cos().

    * lib/msun/Makefile:
      . Add s_sincos[fl].c to the build.
      . Add sincos.3 documentation.
      . Add appropriate MLINKS.

    * lib/msun/Symbol.map:
      . Expose sincos[fl] symbols in dynamic libm.so.

    * lib/msun/man/sincos.3:
      . Documentation for sincos[fl].

    * lib/msun/src/k_sincos.h:
      . Kernel for sincos() function.  This merges the individual kernels
        for sin() and cos().  The merger offered an opportunity to re-arrange
        the individual kernels for better performance.

    * lib/msun/src/k_sincosf.h:
       . Kernel for sincosf() function.  This merges the individual kernels
         for sinf() and cosf(). The merger offered an opportunity to re-arrange
         the individual kernels for better performance.

    * lib/msun/src/k_sincosl.h:
       . Kernel for sincosl() function.  This merges the individual kernels
         for sinl() and cosl(). The merger offered an opportunity to re-arrange
         the individual kernels for better performance.

    * lib/msun/src/math.h:
      . Add prototytpes for sincos[fl]().

    * lib/msun/src/math_private.h:
      . Add RETURNV macros.  This is needed to reset fpsetprec on I386
        hardware for a function with type void.

    * lib/msun/src/s_sincos.c:
      . Implementation of sincos() where sin() and cos() were merged into
        one routine and possibly re-arranged for better performance.

    * lib/msun/src/s_sincosf.c:
      . Implementation of sincosf() where sinf() and cosf() were merged into
        one routine and possibly re-arranged for better performance.

    * lib/msun/src/s_sincosl.c:
      . Implementation of sincosl() where sinl() and cosl() were merged into
        one routine and possibly re-arranged for better performance.

    PR:		215977, 218300
    Submitted by:	Steven G. Kargl <sgk@troutmask.apl.washington.edu>
    Differential Revision:	https://reviews.freebsd.org/D10765

  MFC r321457 (by ngie):

    Mark :reduction as an expected failure

    It fails with clang 5.0+.

    PR:	220989
    Reported by:	Jenkins

  MFC r322418 (by rlibby):

    lib/msun: avoid referring to broken LDBL_MAX

    LDBL_MAX is broken on i386:
    https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html

    Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
    for some time, and newer versions of gcc are now warning that the
    "floating constant exceeds range of 'long double'".  Avoid this by
    referring to half the value of LDBL_MAX instead.

    Reviewed by:	bde
    Approved by:	markj (mentor)
    Sponsored by:	Dell EMC Isilon

  MFC r322435 (by rlibby):

    Revert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches

    Either need a different way to spell HALF_LDBL_MAX, or a different way
    to spell LDBL_MAX_EXP, or a different approach.

    Reported by:	ian

  MFC r322921 (by ngie):

    Revert r321457

    It doesn't fail after ^/head@r322855 (the releng_50 clang merge).

    PR:	220989

Changes:
_U  stable/11/
  stable/11/lib/msun/Makefile
  stable/11/lib/msun/Symbol.map
  stable/11/lib/msun/amd64/Makefile.inc
  stable/11/lib/msun/amd64/e_fmod.S
  stable/11/lib/msun/amd64/e_fmodf.S
  stable/11/lib/msun/amd64/e_fmodl.S
  stable/11/lib/msun/i387/Makefile.inc
  stable/11/lib/msun/i387/e_fmodf.S
  stable/11/lib/msun/i387/e_fmodl.S
  stable/11/lib/msun/ld80/e_lgammal_r.c
  stable/11/lib/msun/ld80/k_expl.h
  stable/11/lib/msun/ld80/s_logl.c
  stable/11/lib/msun/man/cacos.3
  stable/11/lib/msun/man/sincos.3
  stable/11/lib/msun/src/catrig.c
  stable/11/lib/msun/src/catrigl.c
  stable/11/lib/msun/src/e_asin.c
  stable/11/lib/msun/src/e_coshl.c
  stable/11/lib/msun/src/e_lgammaf_r.c
  stable/11/lib/msun/src/e_sinhl.c
  stable/11/lib/msun/src/k_sincos.h
  stable/11/lib/msun/src/k_sincosf.h
  stable/11/lib/msun/src/k_sincosl.h
  stable/11/lib/msun/src/math.h
  stable/11/lib/msun/src/math_private.h
  stable/11/lib/msun/src/s_fabs.c
  stable/11/lib/msun/src/s_fmax.c
  stable/11/lib/msun/src/s_fmin.c
  stable/11/lib/msun/src/s_logbl.c
  stable/11/lib/msun/src/s_scalbn.c
  stable/11/lib/msun/src/s_scalbnf.c
  stable/11/lib/msun/src/s_scalbnl.c
  stable/11/lib/msun/src/s_sincos.c
  stable/11/lib/msun/src/s_sincosf.c
  stable/11/lib/msun/src/s_sincosl.c
  stable/11/lib/msun/src/s_tanhl.c
  stable/11/lib/msun/tests/ctrig_test.c
  stable/11/sys/sys/param.h