xref: /aosp_15_r20/external/musl/android/include/math.h (revision c9945492fdd68bbe62686c5b452b4dc1be3f8453)
1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *  * Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  *  * Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in
12  *    the documentation and/or other materials provided with the
13  *    distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 #pragma once
30 
31 /* GNU extensions not in musl. */
32 
33 #if defined(_GNU_SOURCE)
34 #define M_El            2.718281828459045235360287471352662498L /* e */
35 #define M_LOG2El        1.442695040888963407359924681001892137L /* log 2e */
36 #define M_LOG10El       0.434294481903251827651128918916605082L /* log 10e */
37 #define M_LN2l          0.693147180559945309417232121458176568L /* log e2 */
38 #define M_LN10l         2.302585092994045684017991454684364208L /* log e10 */
39 #define M_PIl           3.141592653589793238462643383279502884L /* pi */
40 #define M_PI_2l         1.570796326794896619231321691639751442L /* pi/2 */
41 #define M_PI_4l         0.785398163397448309615660845819875721L /* pi/4 */
42 #define M_1_PIl         0.318309886183790671537767526745028724L /* 1/pi */
43 #define M_2_PIl         0.636619772367581343075535053490057448L /* 2/pi */
44 #define M_2_SQRTPIl     1.128379167095512573896158903121545172L /* 2/sqrt(pi) */
45 #define M_SQRT2l        1.414213562373095048801688724209698079L /* sqrt(2) */
46 #define M_SQRT1_2l      0.707106781186547524400844362104849039L /* 1/sqrt(2) */
47 #endif
48 
49 #include_next <math.h>
50