1293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh/*
2293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * Copyright (C) 2013 The Android Open Source Project
3293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * All rights reserved.
4293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh *
5293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * Redistribution and use in source and binary forms, with or without
6293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * modification, are permitted provided that the following conditions
7293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * are met:
8293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh *  * Redistributions of source code must retain the above copyright
9293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh *    notice, this list of conditions and the following disclaimer.
10293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh *  * Redistributions in binary form must reproduce the above copyright
11293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh *    notice, this list of conditions and the following disclaimer in
12293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh *    the documentation and/or other materials provided with the
13293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh *    distribution.
14293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh *
15293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh * SUCH DAMAGE.
27293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh */
28293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh#ifndef NDK_ANDROID_SUPPORT_MATH_H
29293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh#define NDK_ANDROID_SUPPORT_MATH_H
30293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh
31293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh#include_next <math.h>
32293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh
33f5cff9096ff6649d5cf429547e217c3f1a502d13Andrew Hsieh#if !defined(__LP64__)
34f5cff9096ff6649d5cf429547e217c3f1a502d13Andrew Hsieh
35293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh#ifdef __cplusplus
36293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehextern "C" {
37293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh#endif
38293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh
39293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh// TODO(digit): Check that this is not needed for Clang.
40293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehtypedef double      double_t;
41ba8c8784fd6f06b931da95e00abf9d871f2adcf1Andrew Hsiehtypedef float       float_t;
42293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh
43293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh// Missing long double functions. Note that 'long double' is the same
4410806f922a75cbfef8f3b4871a49012ee0533fbaAndrew Hsieh// as 'double' on 32-bit Android, so this will define stubs.
45293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh#define LLVM_LIBCXX_LONG_DOUBLE_FUNCTIONS
46293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh
47293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     acosl(long double);
48293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     asinl(long double);
49293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     atanl(long double);
50293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     atan2l(long double x, long double y);
51293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     cosl(long double);
52293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     coshl(long double);
53293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     expl(long double);
54293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     fmodl(long double, long double);
55293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     powl(long double, long double);
56293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     sinl(long double);
57293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     sinhl(long double);
58293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     sqrtl(long double);
59293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     tanl(long double);
60293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     tanhl(long double);
61293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     acoshl(long double);
62293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     asinhl(long double);
63293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     atanhl(long double);
64293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     cbrtl(long double);
65293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     erfl(long double);
66293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     erfcl(long double);
67293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     expm1l(long double);
68293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     hypotl(long double, long double);
69293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     lgammal(long double);
70293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong long int   llrintl(long double);
71293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     logl(long double);
72293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     log1pl(long double);
73293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     log2l(long double);
74293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     logbl(long double);
75293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     log10l(long double);
76293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     nanl(const char*);
77293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     nearbyintl(long double);
78293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     remainderl(long double, long double);
79293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     remquol(long double, long double, int*);
80293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     rintl(long double);
81293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong int        lrintl(long double);
82293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     tgammal(long double);
83293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     modfl(long double, long double*);
84293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehlong double     exp2l(long double);
85293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh
86293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehfloat           tgammaf(float);
87293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehdouble          nan(const char*);
88293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehfloat           nanf(const char*);
89293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh
90293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehfloat           log2f(float);
91293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsiehdouble          log2(double);
92293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh
93293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh#ifdef __cplusplus
94293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh}  // extern "C"
95293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh#endif
96293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh
97f5cff9096ff6649d5cf429547e217c3f1a502d13Andrew Hsieh#endif // !__LP64__
98f5cff9096ff6649d5cf429547e217c3f1a502d13Andrew Hsieh
99293624950fe14bbd43136f46496cbf983ac97fd5Andrew Hsieh#endif  /* NDK_ANDROID_SUPPORT_MATH_H */
100