• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <float.h>
18 #include <math.h>
19 
20 #ifndef __LP64__
21 /*
22  * The BSD "long double" functions are broken when sizeof(long double) == sizeof(double).
23  * Android works around those cases by replacing the broken functions with our own trivial stubs
24  * that call the regular "double" function.
25  */
26 
copysignl(long double a1,long double a2)27 long double copysignl(long double a1, long double a2) { return copysign(a1, a2); }
fabsl(long double a1)28 long double fabsl(long double a1) { return fabs(a1); }
fmaxl(long double a1,long double a2)29 long double fmaxl(long double a1, long double a2) { return fmax(a1, a2); }
fmodl(long double a1,long double a2)30 long double fmodl(long double a1, long double a2) { return fmod(a1, a2); }
fminl(long double a1,long double a2)31 long double fminl(long double a1, long double a2) { return fmin(a1, a2); }
ilogbl(long double a1)32 int ilogbl(long double a1) { return ilogb(a1); }
llrintl(long double a1)33 long long llrintl(long double a1) { return llrint(a1); }
lrintl(long double a1)34 long lrintl(long double a1) { return lrint(a1); }
llroundl(long double a1)35 long long llroundl(long double a1) { return llround(a1); }
lroundl(long double a1)36 long lroundl(long double a1) { return lround(a1); }
modfl(long double a1,long double * a2)37 long double modfl(long double a1, long double* a2) { double i; double f = modf(a1, &i); *a2 = i; return f; }
nexttowardf(float a1,long double a2)38 float nexttowardf(float a1, long double a2) { return nextafterf(a1, (float) a2); }
roundl(long double a1)39 long double roundl(long double a1) { return round(a1); }
40 
41 #endif // __LP64__
42