/[base]/head/lib/msun/src/math.h
ViewVC logotype

Log of /head/lib/msun/src/math.h

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (download) (annotate)
Sticky Revision:


Revision 367030 - (view) (download) (annotate) - [select for diffs]
Modified Sat Oct 24 23:21:22 2020 UTC (3 years, 8 months ago) by imp
File length: 14258 byte(s)
Diff to previous 354255
Remove intel compiler support from math.h

The intel compiler support has badly decayed over the years. Stop
pretending that we support it. Note, I've stopped short of requiring
gcc builtin support with this commit since other compilers may be used
to build non-base software and we need to support those so more
investigation is needed before simplifying further.


Revision 354255 - (view) (download) (annotate) - [select for diffs]
Modified Sat Nov 2 16:59:53 2019 UTC (4 years, 8 months ago) by dim
File length: 14346 byte(s)
Diff to previous 319047
Add __isnan()/__isnanf() aliases for compatibility with glibc and CUDA

Even though clang comes with a number of internal CUDA wrapper headers,
compiling sample CUDA programs will result in errors similar to:

In file included from <built-in>:1:
In file included from /usr/lib/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:204:
/usr/home/arr/cuda/var/cuda-repo-10-0-local-10.0.130-410.48/usr/local/cuda-10.0//include/crt/math_functions.hpp:2910:7: error: no matching function for call to '__isnan'
  if (__isnan(a)) {
      ^~~~~~~
/usr/lib/clang/9.0.0/include/__clang_cuda_device_functions.h:460:16: note: candidate function not viable: call to __device__ function from __host__ function
__DEVICE__ int __isnan(double __a) { return __nv_isnand(__a); }
               ^

CUDA expects __isnan() and __isnanf() declarations to be available,
which are glibc specific extensions, equivalent to the regular isnan()
and isnanf().

To provide these, define __isnan() and __isnanf() as aliases of the
already existing static inline functions __inline_isnan() and
__inline_isnanf() from math.h.

Reported by:	arrowd
PR:		241550
MFC after:	1 week


Revision 319047 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 28 06:13:38 2017 UTC (7 years, 1 month ago) by mmel
File length: 14202 byte(s)
Diff to previous 301761
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>
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10765


Revision 301761 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 9 20:49:26 2016 UTC (8 years ago) by trasz
File length: 14062 byte(s)
Diff to previous 271651
Fix frexpl() declaration to not include the field name.

MFC after:	1 month


Revision 271651 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 15 23:21:57 2014 UTC (9 years, 9 months ago) by kargl
File length: 14068 byte(s)
Diff to previous 269758
* Makefile:
  . Hook e_lgammal[_r].c to the build.
  . Create man page links for lgammal[-r].3.

* Symbol.map:
  . Sort lgammal to its rightful place.
  . Add FBSD_1.4 section for the new lgamal_r symbol.

* ld128/e_lgammal_r.c:
  . 128-bit implementataion of lgammal_r().

* ld80/e_lgammal_r.c:
  . Intel 80-bit format implementation of lgammal_r().

* src/e_lgamma.c:
  . Expose lgammal as a weak reference to lgamma for platforms
    where long double is mapped to double.

* src/e_lgamma_r.c:
  . Use integer literal constants instead of real literal constants.
    Let compiler(s) do the job of conversion to the appropriate type.
  . Expose lgammal_r as a weak reference to lgamma_r for platforms
    where long double is mapped to double.

* src/e_lgammaf_r.c:
  . Fixed the Cygnus Support conversion of e_lgamma_r.c to float.
    This includes the generation of new polynomial and rational
    approximations with fewer terms.  For each approximation, include
    a comment on an estimate of the accuracy over the relevant domain.
  . Use integer literal constants instead of real literal constants.
    Let compiler(s) do the job of conversion to the appropriate type.
    This allows the removal of several explicit casts of double values
    to float.

* src/e_lgammal.c:
  . Wrapper for lgammal() about lgammal_r().

* src/imprecise.c:
  . Remove the lgamma.

* src/math.h:
  . Add a prototype for lgammal_r().

* man/lgamma.3:
  . Document the new functions.

Reviewed by:	bde


Revision 269758 - (view) (download) (annotate) - [select for diffs]
Modified Sat Aug 9 15:53:40 2014 UTC (9 years, 10 months ago) by kargl
File length: 13999 byte(s)
Diff to previous 268593
When r255294 was committed, it exposed the symbols lgammal, powl,
and tgammal in libm.  These functions are part of ISO/IEC 9899:1999
and their prototypes should have been moved into the appropriate
__ISO_C_VISIBLE >= 1999 section.  After moving the prototypes,
remnants of r236148 can be removed.

PR:		standards/191754
Reviewed by:	bde


Revision 268593 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jul 13 17:05:03 2014 UTC (9 years, 11 months ago) by kargl
File length: 14340 byte(s)
Diff to previous 268351
* Makefile:
  . Add s_erfl.c to building libm.
  . Add MLINKS for erfl.3 and erfcl.3.

* Symbol.map:
  . Move erfl and erfcl to their proper location.

* ld128/s_erfl.c:
  . Implementations of erfl and erfcl in the IEEE 754 128-bit format.

* ld80/s_erfl.c:
  . Implementations of erfl and erfcl in the Intel 80-bit format.

* man/erf.3:
  . Document the new functions.
  . While here, remove an incomplete sentence.

* src/imprecise.c:
  . Remove the stupidity of mapping erfl and erfcl to erf and erfc.

* src/math.h:
  . Move the declarations of erfl and erfcl to their proper place.

* src/s_erf.c:
  . For architectures where double and long double are the same
    floating point format, use weak references to map erfl to
    erf and ercl to erfc.

Reviewed by:	bde (many earlier versions)


Revision 268351 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 7 00:27:09 2014 UTC (9 years, 11 months ago) by marcel
File length: 14340 byte(s)
Diff to previous 260067
Remove ia64.

This includes:
o   All directories named *ia64*
o   All files named *ia64*
o   All ia64-specific code guarded by __ia64__
o   All ia64-specific makefile logic
o   Mention of ia64 in comments and documentation

This excludes:
o   Everything under contrib/
o   Everything under crypto/
o   sys/xen/interface
o   sys/sys/elf_common.h

Discussed at: BSDcan


Revision 260067 - (view) (download) (annotate) - [select for diffs]
Modified Mon Dec 30 01:06:21 2013 UTC (10 years, 6 months ago) by kargl
File length: 14408 byte(s)
Diff to previous 253766
* Makefile:
  . Hook coshl, sinhl, and tanhl into libm.
  . Create symbolic links for corresponding manpages.
  . While here remove a nearby extraneous space.

* Symbol.map:
* src/math.h:
  . Move coshl, sinhl, and tanhl to their proper locations.

* man/cosh.3:
* man/sinh.3:
* man/tanh.3:
  . Update the manpages.

* src/e_cosh.c:
* src/e_sinh.c:
* src/s_tanh.c:
  . Add weak reference for LBDL_MANT_DIG==53 targets.

* src/imprecise.c:
  . Remove the coshl, sinhl, and tanhl kludge.

* src/e_coshl.c:
  . ld80 and ld128 implementation of coshl().

* src/e_sinhl.c:
  . ld80 and ld128 implementation of sinhl().

* src/s_tanhl.c:
  . ld80 and ld128 implementation of tanhl().

Obtained from:	bde (mostly), das and kargl


Revision 253766 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 29 12:33:03 2013 UTC (10 years, 11 months ago) by theraven
File length: 14408 byte(s)
Diff to previous 253764
Restore the longer form of the _Generic.  The short form does not work in C++.


Revision 253764 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 29 08:32:13 2013 UTC (10 years, 11 months ago) by theraven
File length: 14082 byte(s)
Diff to previous 253321
Reenable the isnan(double) / isinf(double) declarations when targeting C89 + SUSv2 mode.


Revision 253321 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jul 13 13:04:38 2013 UTC (10 years, 11 months ago) by theraven
File length: 13498 byte(s)
Diff to previous 253319
Cleaner support for type qualifiers.

Submitted by:	Pasi Parviainen


Revision 253319 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jul 13 10:10:45 2013 UTC (10 years, 11 months ago) by theraven
File length: 13824 byte(s)
Diff to previous 253260
Ensure that the _Generic() macro in math.h works with qualified types.

tgmath.h contains the same bugs and so should be fixed in the same way.


Revision 253260 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jul 12 11:03:51 2013 UTC (10 years, 11 months ago) by theraven
File length: 13643 byte(s)
Diff to previous 253219
Fix the build with C++ where __builtin_types_compatible_p is not allowed.


Revision 253219 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jul 11 19:34:16 2013 UTC (10 years, 11 months ago) by theraven
File length: 13569 byte(s)
Diff to previous 253215
Fix some typoes in math.h cleanup.


Revision 253215 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jul 11 17:41:04 2013 UTC (10 years, 11 months ago) by theraven
File length: 13547 byte(s)
Diff to previous 251599
Cleanups to math.h that prevent namespace conflicts with C++.

Reviewed by:	bde
MFC after:	3 days


Revision 251599 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jun 10 06:04:58 2013 UTC (11 years ago) by das
File length: 12994 byte(s)
Diff to previous 251343
Add implementations of acoshl(), asinhl(), and atanhl().  This is a
merge of the work done by bde and myself.


Revision 251343 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jun 3 19:51:32 2013 UTC (11 years, 1 month ago) by kargl
File length: 12994 byte(s)
Diff to previous 251292
ld80 and ld128 implementations of expm1l().  This code started life
as a fairly faithful implementation of the algorithm found in

PTP Tang, "Table-driven implementation of the Expm1 function
in IEEE floating-point arithmetic," ACM Trans. Math. Soft., 18,
211-222 (1992).

Over the last 18-24 months, the code has under gone significant
optimization and testing.

Reviewed by:	bde
Obtained from:	bde (most of the optimizations)


Revision 251292 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jun 3 09:14:31 2013 UTC (11 years, 1 month ago) by das
File length: 12994 byte(s)
Diff to previous 238722
Add logl, log2l, log10l, and log1pl.

Submitted by:	bde


Revision 238722 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 23 19:13:55 2012 UTC (11 years, 11 months ago) by kargl
File length: 12994 byte(s)
Diff to previous 236148
Compute the exponential of x for Intel 80-bit format and IEEE 128-bit
format.  These implementations are based on

PTP Tang, "Table-driven implementation of the exponential function
in IEEE floating-point arithmetic," ACM Trans. Math. Soft., 15,
144-157 (1989).

PR: standards/152415
Submitted by: kargl
Reviewed by: bde, das
Approved by: das (mentor)


Revision 236148 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 27 12:54:41 2012 UTC (12 years, 1 month ago) by theraven
File length: 12994 byte(s)
Diff to previous 227472
Allow inclusion of libc++ <cmath> to work after including math.h

Submitted by:	Yamaya Takashi
Reviewed by:	das
MFC after:	1 week


Revision 227472 - (view) (download) (annotate) - [select for diffs]
Modified Sat Nov 12 19:55:48 2011 UTC (12 years, 7 months ago) by theraven
File length: 13095 byte(s)
Diff to previous 226374
Expose the unimplemented libm functions in the math.h header.  This allows C++'s <cmath> to work without the compiler complaining that the C++ versions are calling implicitly-declared functions.  You will still get a linker error when they are called.  OpenBSD 5.0 claims to fully implement the C99 <math.h> stuff, so might be worth investigating...

Reviewed by:	das
Approved by:	dim (mentor)


Revision 226374 - (view) (download) (annotate) - [select for diffs]
Modified Sat Oct 15 04:24:54 2011 UTC (12 years, 8 months ago) by das
File length: 12822 byte(s)
Diff to previous 219571
Don't define FP_FAST_FMA on sparc64; with the recent fixes, fma() is
no longer "fast" on sparc64.  (It really wasn't to begin with, since
the old implementation was using long doubles, and long doubles are
emulated in software on sparc64.)


Revision 219571 - (view) (download) (annotate) - [select for diffs]
Modified Sat Mar 12 16:50:39 2011 UTC (13 years, 3 months ago) by kargl
File length: 12913 byte(s)
Diff to previous 216211
Implement the long double version for the cube root function, cbrtl.
The algorithm uses Newton's iterations with a crude estimate of the
cube root to converge to a result.

Reviewed by:	bde
Approved by:	das


Revision 216211 - (view) (download) (annotate) - [select for diffs]
Modified Sun Dec 5 22:11:22 2010 UTC (13 years, 7 months ago) by das
File length: 12926 byte(s)
Diff to previous 209110
Add log2() and log2f().


Revision 209110 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 12 17:32:05 2010 UTC (14 years ago) by das
File length: 12885 byte(s)
Diff to previous 189805
Introduce __isnanf() as an alias for isnanf(), and make the isnan()
macro expand to __isnanf() instead of isnanf() for float arguments.
This change is needed because isnanf() isn't declared in strict POSIX
or C99 mode.

Compatibility note: Apps using isnan(float) that are compiled after
this change won't link against an older libm.

Reported by:	Florian Forster <octo@verplant.org>


Revision 189805 - (view) (download) (annotate) - [select for diffs]
Modified Sat Mar 14 18:58:53 2009 UTC (15 years, 3 months ago) by das
File length: 12855 byte(s)
Diff to previous 188272
Namespace: scalb() is withdrawn from POSIX.


Revision 188272 - (view) (download) (annotate) - [select for diffs]
Modified Sat Feb 7 05:41:24 2009 UTC (15 years, 4 months ago) by das
File length: 12805 byte(s)
Diff to previous 186886
C99 TC2 now wants FP_FAST_FMA* to be defined to 1, if the macros are
defined at all. See also: defect report #223.


Revision 186886 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jan 8 06:12:03 2009 UTC (15 years, 5 months ago) by das
File length: 12799 byte(s)
Diff to previous 181074
Fix the types of INFINITY and NAN, which were broken in r131851. They
should both be floats, not doubles.

PR:		127795
Submitted by:	Christoph Mallon
MFC after:	2 weeks


Revision 181074 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jul 31 22:41:26 2008 UTC (15 years, 11 months ago) by das
File length: 12797 byte(s)
Diff to previous 179882
Add implementations of acosl(), asinl(), atanl(), atan2l(),
and cargl().

Reviewed by:			bde
sparc64 testing resources from:	remko


Revision 179882 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 19 22:39:53 2008 UTC (16 years ago) by das
File length: 12758 byte(s)
Diff to previous 177766
Implement fmodl.
Document fmodl and fix some errors in the fmod manpage.


Revision 177766 - (view) (download) (annotate) - [select for diffs]
Modified Sun Mar 30 20:48:02 2008 UTC (16 years, 3 months ago) by das
File length: 12771 byte(s)
Diff to previous 177760
Hook remquol() and remainderl() up to the build.


Revision 177760 - (view) (download) (annotate) - [select for diffs]
Modified Sun Mar 30 20:03:46 2008 UTC (16 years, 3 months ago) by das
File length: 12771 byte(s)
Diff to previous 176720
Hook hypotl() and cabsl() up to the build.


Revision 176720 - (view) (download) (annotate) - [select for diffs]
Modified Sun Mar 2 01:47:58 2008 UTC (16 years, 4 months ago) by das
File length: 12784 byte(s)
Diff to previous 176388
MI implementation of sqrtl(). This is very slow and should
be overridden when hardware sqrt is available.


Revision 176388 - (view) (download) (annotate) - [select for diffs]
Modified Mon Feb 18 17:27:11 2008 UTC (16 years, 4 months ago) by das
File length: 12784 byte(s)
Diff to previous 176360
Add tgammaf() as a simple wrapper around tgamma().


Revision 176360 - (view) (download) (annotate) - [select for diffs]
Modified Sun Feb 17 07:33:12 2008 UTC (16 years, 4 months ago) by das
File length: 12762 byte(s)
Diff to previous 175460
Add implementations of sinl(), cosl(), and tanl().

Submitted by:	Steve Kargl <sgk@apl.washington.edu>


Revision 175460 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jan 18 21:42:46 2008 UTC (16 years, 5 months ago) by das
File length: 12723 byte(s)
Diff to previous 175309
Implement exp2l(). There is one version for machines with 80-bit
long doubles (i386, amd64, ia64) and one for machines with 128-bit
long doubles (sparc64). Other platforms use the double version.
I've only done runtime testing on i386.

Thanks to bde@ for helpful discussions and bugfixes.


Revision 175309 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jan 14 02:12:07 2008 UTC (16 years, 5 months ago) by das
File length: 12710 byte(s)
Diff to previous 174804
Implement rintl(), nearbyintl(), lrintl(), and llrintl().
Thanks to bde@ for feedback and testing of rintl().


Revision 174804 - (view) (download) (annotate) - [select for diffs]
Modified Thu Dec 20 03:16:55 2007 UTC (16 years, 6 months ago) by das
File length: 12723 byte(s)
Diff to previous 174801
Grumble. DO declare logbl(), DON'T declare logl() just yet.
bde is going to commit logl() Real Soon Now.
I'm just trying to slow him down with merge conflicts.

Noticed by:	bde


Revision 174801 - (view) (download) (annotate) - [select for diffs]
Modified Thu Dec 20 00:06:33 2007 UTC (16 years, 6 months ago) by das
File length: 12710 byte(s)
Diff to previous 174684
Remove the declaration of logl(). The relevant bits haven't been
committed yet, but the declaration leaked in when I added nan() and
friends.

Reported by:	pav


Revision 174684 - (view) (download) (annotate) - [select for diffs]
Modified Sun Dec 16 21:19:28 2007 UTC (16 years, 6 months ago) by das
File length: 12723 byte(s)
Diff to previous 165855
Implement and document nan(), nanf(), and nanl(). This commit
adds two new directories in msun: ld80 and ld128. These are for
long double functions specific to the 80-bit long double format
used on x86-derived architectures, and the 128-bit format used on
sparc64, respectively.


Revision 165855 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jan 7 07:54:21 2007 UTC (17 years, 5 months ago) by das
File length: 12642 byte(s)
Diff to previous 145170
Implement modfl().


Revision 145170 - (view) (download) (annotate) - [select for diffs]
Modified Sat Apr 16 21:12:47 2005 UTC (19 years, 2 months ago) by das
File length: 12642 byte(s)
Diff to previous 144772
Implement truncl() based on floorl().


Revision 144772 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 8 01:24:08 2005 UTC (19 years, 2 months ago) by das
File length: 12642 byte(s)
Diff to previous 144648
Add roundl(), lroundl(), and llroundl().


Revision 144648 - (view) (download) (annotate) - [select for diffs]
Modified Tue Apr 5 02:57:15 2005 UTC (19 years, 3 months ago) by das
File length: 12616 byte(s)
Diff to previous 144091
Implement exp2() and exp2f().


Revision 144091 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 25 04:40:44 2005 UTC (19 years, 3 months ago) by das
File length: 12575 byte(s)
Diff to previous 143777
Implement and document remquo() and remquof().


Revision 143777 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 18 01:47:42 2005 UTC (19 years, 3 months ago) by das
File length: 12501 byte(s)
Diff to previous 143221
Add missing prototypes for fma() and fmaf(), and remove an inaccurate
comment.


Revision 143221 - (view) (download) (annotate) - [select for diffs]
Modified Mon Mar 7 04:58:43 2005 UTC (19 years, 4 months ago) by das
File length: 12512 byte(s)
Diff to previous 141280
- Define FP_FAST_FMA for sparc64, since fma() is now implemented using
  sparc64's 128-bit long doubles.
- Define FP_FAST_FMAL for ia64.
- Prototypes for fmal, frexpl, ldexpl, nextafterl, nexttoward{,f,l},
  scalblnl, and scalbnl.


Revision 141280 - (view) (download) (annotate) - [select for diffs]
Modified Fri Feb 4 14:08:32 2005 UTC (19 years, 5 months ago) by das
File length: 12374 byte(s)
Diff to previous 140609
Remove wrappers and other cruft intended to support SVID, mistakes in
C90, and other arcana.  Most of these features were never fully
supported or enabled by default.

Ok:	bde, stefanf


Revision 140609 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jan 22 09:53:18 2005 UTC (19 years, 5 months ago) by das
File length: 13440 byte(s)
Diff to previous 140274
Add fma() and fmaf(), which implement a fused multiply-add operation.


Revision 140274 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jan 15 02:55:10 2005 UTC (19 years, 5 months ago) by das
File length: 13375 byte(s)
Diff to previous 140270
Most libm routines depend on the rounding mode and/or set exception
flags, so they are not pure.  Remove the __pure2 annotation from them.
I believe that the following routines and their float and long double
counterparts are the only ones here that can be __pure2:

	copysign is* fabs finite fmax fmin fpclassify ilogb nan signbit

When gcc supports FENV_ACCESS, perhaps there will be a new annotation
that allows the other functions to be considered pure when FENV_ACCESS
is off.

Discussed with:	bde


Revision 140270 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jan 15 00:37:31 2005 UTC (19 years, 5 months ago) by das
File length: 13506 byte(s)
Diff to previous 140265
Braino.  Revert rev 1.50.

Pointy hat to:	das


Revision 140265 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jan 14 22:03:27 2005 UTC (19 years, 5 months ago) by das
File length: 13374 byte(s)
Diff to previous 140263
Set math_errhandling to MATH_ERREXCEPT.  Now that we have fenv.h, we
basically support this, subject to gcc's lack of FENV_ACCESS support.
In any case, the previous setting of math_errhandling to 0 is not
allowed by POSIX.


Revision 140263 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jan 14 21:51:46 2005 UTC (19 years, 5 months ago) by das
File length: 13361 byte(s)
Diff to previous 140172
Remove some #if 0'd code.


Revision 140172 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jan 13 09:11:41 2005 UTC (19 years, 5 months ago) by stefanf
File length: 13493 byte(s)
Diff to previous 140142
Implement and document ceill().


Revision 140142 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 12 22:10:46 2005 UTC (19 years, 5 months ago) by stefanf
File length: 13493 byte(s)
Diff to previous 140141
Implement floorl().


Revision 140141 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 12 22:05:41 2005 UTC (19 years, 5 months ago) by stefanf
File length: 13493 byte(s)
Diff to previous 140088
Whitespace nit.


Revision 140088 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jan 11 23:12:55 2005 UTC (19 years, 5 months ago) by das
File length: 13493 byte(s)
Diff to previous 136385
Add MI implementations of [l]lrint[f]() and [l]lround[f]().

Discussed with:	bde


Revision 136385 - (view) (download) (annotate) - [select for diffs]
Modified Mon Oct 11 18:13:52 2004 UTC (19 years, 8 months ago) by stefanf
File length: 13305 byte(s)
Diff to previous 135360
Add and document ilogbl(), a long double version of ilogb().


Revision 135360 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 17 05:15:33 2004 UTC (19 years, 9 months ago) by das
File length: 13292 byte(s)
Diff to previous 132382
Further refine some #ifs:
- Simplify the logic by using __GNUC_PREREQ__.
  Suggested by stefanf.
- Make math.h compile with old (pre-8.0) versions of icc.
  Submitted by sf [sic].


Revision 132382 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 19 08:16:10 2004 UTC (19 years, 11 months ago) by das
File length: 13337 byte(s)
Diff to previous 132292
Fix two bugs in the signbit() macro, which was implemented last year:

- It was added to libc instead of libm.  Hopefully no programs rely
  on this mistake.

- It didn't work properly on large long doubles because its argument
  was converted to type double, resulting in undefined behavior.


Revision 132292 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jul 17 15:03:52 2004 UTC (19 years, 11 months ago) by stefanf
File length: 13146 byte(s)
Diff to previous 132246
Fix minor namespace pollution:  The prototypes for f{dim,max,min}(),
nearbyint(), round() and trunc() shouldn't be visible when compiling with
-D_XOPEN_SOURCE=500.


Revision 132246 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jul 16 06:21:56 2004 UTC (19 years, 11 months ago) by das
File length: 13146 byte(s)
Diff to previous 131852
Tweak the conditions under which certain gcc builtins are used:

- Unlike the builtin relational operators, builtin floating-point
  constants were not available until gcc 3.3, so account for this.[1]

- Apparently some versions of the Intel C Compiler fallaciously define
  __GNUC__ without actually being compatible with the claimed gcc
  version.  Account for this, too.[2]

[1] Noticed by:		Christian Hiris <4711@chello.at>
[2] Submitted by:	Alexander Leidinger <Alexander@Leidinger.net>


Revision 131852 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jul 9 03:32:40 2004 UTC (19 years, 11 months ago) by das
File length: 13072 byte(s)
Diff to previous 131851
Implement the classification macros isfinite(), isinf(), isnan(), and
isnormal() the hard way, rather than relying on fpclassify().  This is
a lose in the sense that we need a total of 12 functions, but it is
necessary for binary compatibility because we have never bumped libm's
major version number.  In particular, isinf(), isnan(), and isnanf()
were BSD libc functions before they were C99 macros, so we can't
reimplement them in terms of fpclassify() without adding a dependency
on libc.so.5.  I have tried to arrange things so that programs that
could be compiled in FreeBSD 4.X will generate the same external
references when compiled in 5.X.  At the same time, the new macros
should remain C99-compliant.

The isinf() and isnan() functions remain in libc for historical
reasons; however, I have moved the functions that implement the macros
isfinite() and isnormal() to libm where they belong.  Moreover,
half a dozen MD versions of isinf() and isnan() have been replaced
with MI versions that work equally well.

Prodded by:	kris


Revision 131851 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jul 9 03:31:09 2004 UTC (19 years, 11 months ago) by das
File length: 12317 byte(s)
Diff to previous 131676
Define the following macros in terms of [gi]cc builtins when the
builtins are available: HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY,
and NAN.  These macros now expand to floating-point constant
expressions rather than external references, as required by C99.
Other compilers will retain the historical behavior.  Note that
it is not possible say, e.g.
#define	HUGE_VAL	1.0e9999
because the above may result in diagnostics at translation time
and spurious exceptions at runtime.  Hence the need for compiler
support for these features.

Also use builtins to implement the macros isgreater(),
isgreaterequal(), isless(), islessequal(), islessgreater(),
and isunordered() when such builtins are available.
Although the old macros are correct, the builtin versions
are much faster, and they avoid double-expansion problems.


Revision 131676 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jul 6 04:46:08 2004 UTC (20 years ago) by das
File length: 11407 byte(s)
Diff to previous 131320
Add C99's nearbyint{,f}() functions as wrappers around rint().
These trivial implementations are about 25 times slower than
rint{,f}() on x86 due to the FP environment save/restore.
They should eventually be redone in terms of fegetround() and
bit fiddling.


Revision 131320 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 30 07:04:01 2004 UTC (20 years ago) by das
File length: 11340 byte(s)
Diff to previous 130768
Implement and document fdim{,f,l}, fmax{,f,l}, and fmin{,f,l}.


Revision 130768 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jun 20 09:26:41 2004 UTC (20 years ago) by das
File length: 11110 byte(s)
Diff to previous 130713
Declare scalbln(), scalblnf(), trunc(), and truncf().


Revision 130713 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 19 09:25:21 2004 UTC (20 years ago) by stefanf
File length: 11008 byte(s)
Diff to previous 130264
Our MI implementation of ilogb() returns -INT_MAX for the argument 0.0 rather
than INT_MIN, so adjust FP_ILOGB0 to reflect this.  Use <machine/_limits.h> for
INT_MAX's value while there.

Reviewed by:	standards@


Revision 130264 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 9 10:32:05 2004 UTC (20 years ago) by das
File length: 11014 byte(s)
Diff to previous 130179
Include <sys/cdefs.h> earlier to get the various visibility constants.
Previously, we were relying on <sys/_types.h> to include it implicitly.


Revision 130179 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jun 7 08:05:36 2004 UTC (20 years, 1 month ago) by das
File length: 11015 byte(s)
Diff to previous 129040
Add round(3) and roundf(3) and the associated documentation.

PR:		59797
Submitted by:	"Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
Reviewed by:	bde (earlier version, last year)


Revision 129040 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 7 18:56:31 2004 UTC (20 years, 2 months ago) by stefanf
File length: 10972 byte(s)
Diff to previous 128628
Add an implementation of copysignl(), a long double version of copysign().

Approved by:	das (mentor)


Revision 128628 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 25 02:35:42 2004 UTC (20 years, 2 months ago) by das
File length: 10959 byte(s)
Diff to previous 128627
Make sure that symbols are declared in math.h iff the appropriate
namespaces are visible.  Previously, math.h failed to hide some C99-,
XSI-, and BSD-specific symbols in certain compilation environments.

The referenced PR has a nice listing of the appropriate conditions for
making symbols visible in math.h.  The only non-stylistic difference
between the patch in the PR and this commit is that I superfluously
test for __BSD_VISIBLE in a few places to be more explicit about which
symbols have historically been part of the FreeBSD environment.

PR:		65939
Submitted by:	Stefan Farfeleder <stefan@fafoe.narf.at>


Revision 128627 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 25 02:32:46 2004 UTC (20 years, 2 months ago) by das
File length: 10869 byte(s)
Diff to previous 126873
Remove a stale comment referring to values.h, which has never been
part of FreeBSD.

PR:		65939


Revision 126873 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 12 12:05:38 2004 UTC (20 years, 3 months ago) by bde
File length: 10994 byte(s)
Diff to previous 126871
THe log message for the previous commit should have said:

Submitted by:	Stefan Farfeleder <stefan@fafoe.narf.at>
PR:		standards/56906


Revision 126871 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 12 12:02:03 2004 UTC (20 years, 3 months ago) by bde
File length: 10994 byte(s)
Diff to previous 121418
Initial support for C99's (or is it POSIX.1-2001's?) MATH_ERRNO,
MATH_ERREXCEPTION and math_errhandling, so that C99 applications at
least have the possibility of determining that errno is not set for
math functions.  Set math_errhandling to the non-standard-conforming
value of 0 for now to indicate that we don't support either method
of reporting errors.  We intentionally don't support MATH_ERRNO
because errno is a mistake, and we are missing support for
MATH_ERREXCEPTION (<fenv.h>, compiler support for <fenv.h>, and
actually setting the exception flags correctly).


Revision 121418 - (view) (download) (annotate) - [select for diffs]
Modified Thu Oct 23 08:23:38 2003 UTC (20 years, 8 months ago) by des
File length: 10885 byte(s)
Diff to previous 115230
Add prototypes for all long double functions in C99.  Leave them all
#if 0'd out, except for fabsl(3) which I've implemented.


Revision 115230 - (view) (download) (annotate) - [select for diffs]
Modified Thu May 22 17:07:57 2003 UTC (21 years, 1 month ago) by mike
File length: 8634 byte(s)
Diff to previous 113077
Fix two misuses of __BSD_VISIBLE.

Submitted by:	bde
Approved by:	re


Revision 113077 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 4 13:27:47 2003 UTC (21 years, 3 months ago) by das
File length: 8640 byte(s)
Diff to previous 111546
Fix braino in definition of isfinite().

Noticed by:	marcus
Pointy hat to:	das


Revision 111546 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 26 13:12:03 2003 UTC (21 years, 4 months ago) by imp
File length: 8638 byte(s)
Diff to previous 110769
- gamma_r, lgamma_r, gammaf_r, and lgammaf_r were protected by _REENTRANT
  in math.h; the consensus here was that __BSD_VISIBLE was correct instead.

- gamma_r, lgamma_r, gammaf_r, and lgammaf_r had no documentation in the
  lgamma(3) manpage.

Reviewed by: standards@
Submitted by: Ben Mesander


Revision 110769 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 12 20:03:41 2003 UTC (21 years, 4 months ago) by mike
File length: 8626 byte(s)
Diff to previous 110734
o Implement C99 classification macros isfinite(), isinf(), isnan(),
  isnormal().  The current isinf() and isnan() are perserved for
  binary compatibility with 5.0, but new programs will use the macros.
o Implement C99 comparison macros isgreater(), isgreaterequal(),
  isless(), islessequal(), islessgreater(), isunordered().

Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>


Revision 110734 - (view) (download) (annotate) - [select for diffs]
Modified Tue Feb 11 21:56:21 2003 UTC (21 years, 4 months ago) by mike
File length: 8027 byte(s)
Diff to previous 110566
Implement C99's signbit() macro.


Revision 110566 - (view) (download) (annotate) - [select for diffs]
Modified Sat Feb 8 20:37:55 2003 UTC (21 years, 4 months ago) by mike
File length: 7972 byte(s)
Diff to previous 106268
Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
  contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
  contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
  storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
  double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
  HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
  <math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
  <machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
  on the size of its argument.  __fpclassifyl() is never called on
  alpha because (sizeof(long double) == sizeof(double)), which is good
  since __fpclassifyl() can't deal with such a small `long double'.

This was developed by David Schultz and myself with input from bde and
fenner.

PR:		23103
Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>
		(significant portions)
Reviewed by:	bde, fenner (earlier versions)


Revision 106268 - (view) (download) (annotate) - [select for diffs]
Modified Thu Oct 31 23:05:20 2002 UTC (21 years, 8 months ago) by archie
File length: 7162 byte(s)
Diff to previous 105809
Re-apply the previously backed-out commit that fixes the problem where
HUGE_VAL is not properly aligned on some architectures. The previous
fix now works because the two versions of 'math.h' (include/math.h
and lib/msun/src/math.h) have since been merged into one.

PR:	bin/43544


Revision 105809 - (view) (download) (annotate) - [select for diffs]
Modified Wed Oct 23 17:35:11 2002 UTC (21 years, 8 months ago) by markm
File length: 7107 byte(s)
Diff to previous 104281
Remove duplicate declaration.


Revision 104281 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 1 11:44:35 2002 UTC (21 years, 9 months ago) by bde
File length: 7134 byte(s)
Diff to previous 104280
Fixed a last-minute editing error in previous commit.  nfs and/or cvs
replaced a 14-byte change in the middle of the file with 14 NULs at EOF
despite or because of aborting the initial commit to pick up the change.


Revision 104280 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 1 11:34:42 2002 UTC (21 years, 9 months ago) by bde
File length: 7134 byte(s)
Diff to previous 103686
Merged all interesting difference between the old math.h and the current
one into the latter and removed the former.

This works around the bug that some broken Makefiles add -I.../src/include
to CFLAGS, resulting in the old math.h being preferred and differences
between the headers possibly being fatal.

The merge mainly involves declaring some functions as __pure2 although
they are not yet all strictly free of side effects.

PR:		43544


Revision 103686 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 20 15:43:26 2002 UTC (21 years, 9 months ago) by archie
File length: 6240 byte(s)
Diff to previous 103653
Revert previous commit to unbreak world until we figure out the
right way to do it.


Revision 103653 - (view) (download) (annotate) - [select for diffs]
Modified Thu Sep 19 19:47:27 2002 UTC (21 years, 9 months ago) by archie
File length: 6295 byte(s)
Diff to previous 93211
Fix a problem with the definition of HUGE_VAL causing the gcc warning
"cast increases required alignment of target type" on some platforms.

Reviewed by:	bde


Revision 93211 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 26 11:59:29 2002 UTC (22 years, 3 months ago) by bde
File length: 6240 byte(s)
Diff to previous 93197
Resurrect Lite1's gamma() as C99's tgamma().  Minimal changes.


Revision 93197 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 26 09:18:09 2002 UTC (22 years, 3 months ago) by bde
File length: 6217 byte(s)
Diff to previous 92917
Fixed some minor style bugs.


Revision 92917 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 21 23:54:04 2002 UTC (22 years, 3 months ago) by obrien
File length: 6217 byte(s)
Diff to previous 87805
Remove __P() usage.


Revision 87805 - (view) (download) (annotate) - [select for diffs]
Modified Thu Dec 13 17:22:17 2001 UTC (22 years, 6 months ago) by phantom
File length: 6865 byte(s)
Diff to previous 78172
Fix style bugs (mostly remove 'extern' from function prototypes)

Inspired by: conversation with bde


Revision 78172 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 13 15:16:30 2001 UTC (23 years ago) by ru
File length: 7621 byte(s)
Diff to previous 58647
Added skeleton <complex.h> (aligned with the POSIX.1-200x), mostly
to fix the "-nostdinc WARNS=X" breakage caused by broken prototypes
for cabs() and cabsl() in <math.h>.

Reimplemented cabs() and cabsl() using new complex numbers types and
moved prototypes from <math.h> to <complex.h>.


Revision 58647 - (view) (download) (annotate) - [select for diffs]
Modified Mon Mar 27 02:04:45 2000 UTC (24 years, 3 months ago) by obrien
File length: 7666 byte(s)
Diff to previous 50476
MFS: Add a "magic" comment to help fixincludes realize it doesn't need to
modify this file when building GCC 2.96 [by hand or via the port].

Submitted by:	Zack Weinberg <zack@wolery.cumb.org>


Revision 50476 - (view) (download) (annotate) - [select for diffs]
Modified Sat Aug 28 00:22:10 1999 UTC (24 years, 10 months ago) by peter
File length: 7578 byte(s)
Diff to previous 35399
$Id$ -> $FreeBSD$


Revision 35399 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 23 04:44:08 1998 UTC (26 years, 2 months ago) by pst
File length: 7616 byte(s)
Diff to previous 35380
Back out last change


Revision 35380 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 22 06:26:18 1998 UTC (26 years, 2 months ago) by pst
File length: 7638 byte(s)
Diff to previous 28971
Fix cabs and cabsf definitions to be prototypes.


Revision 28971 - (view) (download) (annotate) - [select for diffs]
Modified Sun Aug 31 22:12:19 1997 UTC (26 years, 10 months ago) by bde
File length: 7618 byte(s)
Diff to previous 22993
Hide the declaration of `struct exception' from C++, since it conflicts
with the standard C++ `class exception'.  This makes matherr() difficult
to use in C++.  Small loss.


Revision 22993 - (view) (download) (annotate) - [select for diffs]
Added Sat Feb 22 15:12:41 1997 UTC (27 years, 4 months ago) by peter
File length: 7519 byte(s)
Diff to previous 21673
Revert $FreeBSD$ to $Id$



This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

  ViewVC Help
Powered by ViewVC 1.1.27