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