summaryrefslogtreecommitdiffstats
path: root/libcxx/include/cmath
Commit message (Collapse)AuthorAgeFilesLines
* [libc++] Harden usage of static_assert against C++03Louis Dionne2019-10-011-2/+2
| | | | | | | In C++03, we emulate static_assert with a macro, and we must parenthesize multiple arguments. llvm-svn: 373328
* [libc++] Move __clamp_to_integral to <cmath>, and harden against min()/max() ↵Louis Dionne2019-09-041-0/+36
| | | | | | macros llvm-svn: 370900
* Apply new meta-programming traits throughout the library.Eric Fiselier2019-06-231-1/+1
| | | | | | The new meta-programming primitives are lower cost than the old versions. This patch removes those old versions and switches libc++ to use the new ones. llvm-svn: 364160
* Remove unneeded <algorithm> include in cmath.Eric Fiselier2019-05-061-1/+0
| | | | | | | It's a remnant from an earlier version of the lerp change and is unneeded. llvm-svn: 360098
* Implement 'lerp'; which is the last bit of P0811. Mark that paper as complete.Marshall Clow2019-04-251-0/+27
| | | | llvm-svn: 359211
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* Implement the infrastructure for feature-test macros. Very few actual ↵Marshall Clow2018-09-121-0/+1
| | | | | | feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955 llvm-svn: 342073
* [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by ↵Louis Dionne2018-07-111-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | _LIBCPP_INLINE_VISIBILITY Summary: We never actually mean to always inline a function -- all the uses of the macro I could find are actually attempts to control the visibility of symbols. This is better described by _LIBCPP_INLINE_VISIBILITY, which is actually always defined the same. This change is orthogonal to the decision of what we're actually going to do with _LIBCPP_INLINE_VISIBILITY -- it just simplifies things by having one canonical way of doing things. Note that this commit had originally been applied in r336369 and then reverted in r336382 because of unforeseen problems. Both of these problems have now been fixed. Reviewers: EricWF, mclow.lists Subscribers: christof, dexonsmith, erikvanderpoel Differential Revision: https://reviews.llvm.org/D48892 llvm-svn: 336866
* Revert "[libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by ↵Louis Dionne2018-07-051-6/+6
| | | | | | | | | | | | | | | _LIBCPP_INLINE_VISIBILITY" This reverts commit r336369. The commit had two problems: 1. __pbump was marked as _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY instead of _LIBCPP_INLINE_VISIBILITY, which lead to two symbols being added in the dylib and the check-cxx-abilist failing. 2. The LLDB tests started failing because they undefine `_LIBCPP_INLINE_VISIBILITY`. I need to figure out why they do that and fix the tests before we can go forward with this change. llvm-svn: 336382
* [libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITYLouis Dionne2018-07-051-6/+6
| | | | | | | | | | | | | | | | | | | | Summary: We never actually mean to always inline a function -- all the uses of the macro I could find are actually attempts to control the visibility of symbols. This is better described by _LIBCPP_INLINE_VISIBILITY, which is actually always defined the same. This change is orthogonal to the decision of what we're actually going to do with _LIBCPP_INLINE_VISIBILITY -- it just simplifies things by having one canonical way of doing things. Reviewers: EricWF Subscribers: christof, llvm-commits, dexonsmith, erikvanderpoel, mclow.lists Differential Revision: https://reviews.llvm.org/D48892 llvm-svn: 336369
* cmath: Support clang's -fdelayed-template-parsingDuncan P. N. Exon Smith2017-07-071-6/+6
| | | | | | | | | | | r283051 added some functions to cmath (in namespace std) that have the same name as functions in math.h (in the global namespace). Clang's limited support for `-fdelayed-template-parsing` chokes on this. Rename the ones in `cmath` and their uses in `complex` and the test. rdar://problem/32848355 llvm-svn: 307357
* [libc++] Drop support for CRTs older than VS 2015Shoaib Meenai2017-04-071-6/+0
| | | | | | | | | | | LLVM dropped support for Visual Studio versions older than 2015 quite some time ago, so I consider it safe to drop libc++'s support for older CRTs. The CRT in Visual Studio 2015 provides a lot of previously missing functions, so targeting it requires less special casing. Differential Revision: https://reviews.llvm.org/D31798 llvm-svn: 299743
* math: fix typo in macroSaleem Abdulrasool2017-02-171-6/+6
| | | | | | MAJOR was misspelt as NAJOR. Fix the spelling. llvm-svn: 295510
* cmath: Use c99 math on a new enough msvcrtSaleem Abdulrasool2017-02-171-4/+4
| | | | | | | MSVCRT 14+ supports the C99 math routines that we need. Use them accordingly. llvm-svn: 295509
* math: correct the MSVCRT conditionSaleem Abdulrasool2017-02-161-2/+2
| | | | | | Fixes a number of tests in the testsuite on Windows. llvm-svn: 295330
* math: actually pull the declarations/overloads into stdSaleem Abdulrasool2017-02-131-1/+1
| | | | | | | The previous changes missed the change to include/cmath. These changes allow some of the rand.distribution tests to pass on Windows. llvm-svn: 294957
* cmath: adjust math forwards for WindowsSaleem Abdulrasool2017-02-121-2/+2
| | | | | | | | The newer versions of ucrt have the math routines. Use the CRT version to determine if we should include the math routines. Fixes two tests for Windows. llvm-svn: 294899
* [CUDA] Mark __libcpp_{isnan,isinf,isfinite} as constexpr.Justin Lebar2016-11-151-6/+6
| | | | | | | | | | | | | | Summary: This makes these functions available on host and device, which is necessary to compile <complex> for the device. Reviewers: hfinkel, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25403 llvm-svn: 287012
* [libc++] Remove unnecessary MSVCRT exclusionsShoaib Meenai2016-11-081-6/+0
| | | | | | | | | | | | Visual Studio 2013 and up have these functions, and we don't need to support older versions. There are some remaining _LIBCPP_MSVCRT exclusions which are present on Visual Studio 2015 but not 2013. Those will be addressed in a follow-up. Differential Revision: https://reviews.llvm.org/D26377 llvm-svn: 286202
* Remove some additional unnecessary std:: in cmathHal Finkel2016-10-011-9/+9
| | | | | | | Unlike in math.h, as Eric pointed out in the review of D18639, we don't need the std:: in cmath. llvm-svn: 283052
* Use __builtin_isnan/isinf/isfinite in complexHal Finkel2016-10-011-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The libc-provided isnan/isinf/isfinite macro implementations are specifically designed to function correctly, even in the presence of -ffast-math (or, more specifically, -ffinite-math-only). As such, on most implementation, these either always turn into external function calls (e.g. glibc) or are specifically function calls when FINITE_MATH_ONLY is defined (e.g. Darwin). Our implementation of complex arithmetic makes heavy use of isnan/isinf/isfinite to deal with corner cases involving non-finite quantities. This was problematic in two respects: 1. On systems where these are always function calls (e.g. Linux/glibc), there was a performance penalty 2. When compiling with -ffast-math, there was a significant performance penalty (in fact, on Darwin and systems with similar implementations, the code may in fact be slower than not using -ffast-math, because the inline definitions provided by libc become unavailable to prevent the checks from being optimized out). Eliding these inf/nan checks in -ffast-math mode is consistent with what happens with libstdc++, and in my experience, what users expect. This is critical to getting high-performance code when using complex<T>. This change replaces uses of those functions on basic floating-point types with calls to __builtin_isnan/isinf/isfinite, which Clang will always expand inline. When using -ffast-math (or -ffinite-math-only), the optimizer will remove the checks as expected. Differential Revision: https://reviews.llvm.org/D18639 llvm-svn: 283051
* Fix PR28506. Re-enable missing math.h C++11 decls on SunOS. Patch from ↵Eric Fiselier2016-08-151-18/+0
| | | | | | Michal Gorny. llvm-svn: 278716
* Implement P0030R1: Introduce a 3-Argument Overload to std::hypotMarshall Clow2016-05-171-0/+28
| | | | llvm-svn: 269772
* Split <math.h> out of <cmath>.Richard Smith2015-10-081-1156/+12
| | | | llvm-svn: 249742
* Provide std::abs(<floating-point>) in <cmath> on Solaris.Eric Fiselier2015-03-181-0/+4
| | | | | | | | | | | | | | | | 1) <cstdlib> header should define std::abs([int|long|long long]) functions. They use "using ::abs" to import these functions (which are declared in <stdlib.h>) into std namespace. 2) <cmath> header should define std::abs([float|double|long double]) function. If we try define new functions in std namespace, then it will cause compile error in <cstdlib> because "using ::abs" will try import not only [int|long|long long] functions, but also [float|double|long double] which are defined in <math.h> header on solaris. Patch by C Bergstrom. llvm-svn: 232641
* cmath: account for MSVCRT 12.0 changesSaleem Abdulrasool2015-02-281-2/+10
| | | | | | | | | | | | | | MSVCRT 12.0 introduces better compatibility for C99. This includes a number of math routines that were previously undefined. Use the crtversion.h header to detect the version of MSVCRT being targeted and avoid re-declaring the variables. Since copysign has been introduced in MSVCRT, importing the definition via using makes it difficult to provide overloads (due to minor differences between throw () and noexcept. Avoid defining the overloads on newer MSVCRT targets. llvm-svn: 230867
* Get libc++ building on Sun Solaris. Patch from C Bergstrom.Eric Fiselier2015-01-231-1/+1
| | | | llvm-svn: 226947
* [libcxx] Fix SFINAE in <cmath>. Patch from K-Ballo.Eric Fiselier2014-10-171-24/+24
| | | | | | | | Delay instantiation of `__numeric_type` within <cmath>, don't instantiate it when the `is_arithmetic` conditions do not hold as it causes errors with user-defined types with ambiguous conversions. Fixes PR21083. llvm-svn: 219998
* Rename arguments in include/cmath to work around Newlib macro implementation ↵Jonathan Roelofs2014-08-271-230/+230
| | | | | | | | using these particular names http://reviews.llvm.org/D5080 llvm-svn: 216548
* Remove definition of std::fmaf from libc++. Fixes bug #18910. This function ↵Marshall Clow2014-03-051-5/+1
| | | | | | should come from the C standard library. As a drive-by fix, update the tests to remove a warning from -Wabsolute-value llvm-svn: 202990
* Back out the <type_traits> changes from r198431; they were breaking when ↵Marshall Clow2014-01-061-55/+15
| | | | | | building with glibc. Need to find a better solution for PR18218. llvm-svn: 198623
* Patch by Howard. First part of fix for PR18218; add type traits needed to do ↵Marshall Clow2014-01-031-16/+55
| | | | | | the right thing. Fix the problems in PR18218 for isnan and pow - they also need to be applied to the other functions in <cmath>. Also, a drive-by fix for the test - now actually calls test_abs() llvm-svn: 198431
* Glen: Remove unneeded _LIBCPP_ALWAYS_INLINE.Howard Hinnant2013-08-291-1/+1
| | | | llvm-svn: 189626
* Xing Xue: port to IBM XLC++/AIX.Howard Hinnant2013-08-141-22/+24
| | | | llvm-svn: 188396
* Nico Rieck: Currently _MSC_VER and _WIN32 are used to guard code which isHoward Hinnant2013-08-011-36/+41
| | | | | | | | | | | | | | | | | | | | | | MSVC-specific, MSVCRT-specific, or Windows-specific. Because Clang can also define _MSC_VER, and MSVCRT is not necessarily the only C runtime, these macros should not be used interchangeably. This patch divides all Windows-related bits into the aforementioned categories. Two new macros are introduced: - _LIBCPP_MSVC: Defined when compiling with MSVC. Detected using _MSC_VER, excluding Clang. - _LIBCPP_MSVCRT: Defined when using the Microsoft CRT. This is the default when _WIN32 is defined. This leaves _WIN32 for code using the Windows API. This also corrects the spelling of _LIBCP_HAS_IS_BASE_OF to _LIBCPP_HAS_IS_BASE_OF. Nico, please prepare a patch for CREDITS.TXT, thanks. llvm-svn: 187593
* Make <cmath> classification macros work with integral types.Howard Hinnant2013-01-141-42/+48
| | | | llvm-svn: 172461
* Dimitry Andric: Silence some miscellaneous warnings.Howard Hinnant2012-11-061-0/+2
| | | | llvm-svn: 167493
* Apply noexcept to those functions implemented in <cmath> as a conforming ↵Howard Hinnant2012-07-061-195/+195
| | | | | | extension. llvm-svn: 159849
* Change std::abs from a template function to three overloads for float, ↵Howard Hinnant2012-05-031-3/+10
| | | | | | double and long double. llvm-svn: 156064
* Fix MSVC / Sun #ifdef ordering. Remove another #if-nothing-#endif.David Chisnall2012-02-291-4/+2
| | | | | | Sorry for the churn. llvm-svn: 151731
* Remove a spurious #ifdef / #endif pair with nothing between them.David Chisnall2012-02-291-2/+0
| | | | llvm-svn: 151729
* Solaris port. Currently sees around 200 test failures, mostly related toDavid Chisnall2012-02-291-1/+33
| | | | | | | | | | Solaris not providing some of the locales that the test suite uses. Note: This depends on an xlocale (partial) implementation for Solaris and a couple of fixed standard headers. These will be committed to a branch later today. llvm-svn: 151720
* Quash a whole bunch of warningsHoward Hinnant2011-12-011-1/+1
| | | | llvm-svn: 145624
* Windows port work by Ruben Van BoxemHoward Hinnant2011-10-271-0/+64
| | | | llvm-svn: 143105
* Windows support by Ruben Van Boxem.Howard Hinnant2011-10-171-0/+2
| | | | llvm-svn: 142235
* http://llvm.org/bugs/show_bug.cgi?id=9854. Also created an emulated ↵Howard Hinnant2011-05-131-342/+332
| | | | | | hexfloat literal for use in some of the tests. <sigh> And cleaned up some harmless but irritating warnings in the tests. llvm-svn: 131318
* license changeHoward Hinnant2010-11-161-2/+2
| | | | llvm-svn: 119395
* I have reverted all contributions made by Jesse Towner in revision 110724Howard Hinnant2010-11-161-11/+0
| | | | llvm-svn: 119383
* visibility-decoration.Howard Hinnant2010-09-211-73/+68
| | | | llvm-svn: 114486
* Getting started on a visibility-decoration sweep.Howard Hinnant2010-09-211-67/+12
| | | | llvm-svn: 114440
OpenPOWER on IntegriCloud