1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2020 Blender Foundation.
17  * All rights reserved.
18  */
19 
20 /* On Linux, precompiled libraries may be made with an glibc version that is
21  * incompatible with the system libraries that Blender is built on. To solve
22  * this we add a few -ffast-math symbols that can be missing. */
23 
24 #ifdef __linux__
25 #  include <features.h>
26 #  include <math.h>
27 
28 #  if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 31)
29 
30 double __exp_finite(double x);
31 double __exp2_finite(double x);
32 double __acos_finite(double x);
33 double __asin_finite(double x);
34 double __log2_finite(double x);
35 double __log10_finite(double x);
36 double __log_finite(double x);
37 double __pow_finite(double x, double y);
38 float __expf_finite(float x);
39 float __exp2f_finite(float x);
40 float __acosf_finite(float x);
41 float __asinf_finite(float x);
42 float __log2f_finite(float x);
43 float __log10f_finite(float x);
44 float __logf_finite(float x);
45 float __powf_finite(float x, float y);
46 
__exp_finite(double x)47 double __exp_finite(double x)
48 {
49   return exp(x);
50 }
51 
__exp2_finite(double x)52 double __exp2_finite(double x)
53 {
54   return exp2(x);
55 }
56 
__acos_finite(double x)57 double __acos_finite(double x)
58 {
59   return acos(x);
60 }
61 
__asin_finite(double x)62 double __asin_finite(double x)
63 {
64   return asin(x);
65 }
66 
__log2_finite(double x)67 double __log2_finite(double x)
68 {
69   return log2(x);
70 }
71 
__log10_finite(double x)72 double __log10_finite(double x)
73 {
74   return log10(x);
75 }
76 
__log_finite(double x)77 double __log_finite(double x)
78 {
79   return log(x);
80 }
81 
__pow_finite(double x,double y)82 double __pow_finite(double x, double y)
83 {
84   return pow(x, y);
85 }
86 
__expf_finite(float x)87 float __expf_finite(float x)
88 {
89   return expf(x);
90 }
91 
__exp2f_finite(float x)92 float __exp2f_finite(float x)
93 {
94   return exp2f(x);
95 }
96 
__acosf_finite(float x)97 float __acosf_finite(float x)
98 {
99   return acosf(x);
100 }
101 
__asinf_finite(float x)102 float __asinf_finite(float x)
103 {
104   return asinf(x);
105 }
106 
__log2f_finite(float x)107 float __log2f_finite(float x)
108 {
109   return log2f(x);
110 }
111 
__log10f_finite(float x)112 float __log10f_finite(float x)
113 {
114   return log10f(x);
115 }
116 
__logf_finite(float x)117 float __logf_finite(float x)
118 {
119   return logf(x);
120 }
121 
__powf_finite(float x,float y)122 float __powf_finite(float x, float y)
123 {
124   return powf(x, y);
125 }
126 
127 #  endif /* __GLIBC_PREREQ */
128 #endif   /* __linux__ */
129