Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define _DECLARE_C99_LDBL_MATH 1
|
|
|
|
|
2014-02-19 16:42:58 +01:00
|
|
|
// This include (and the associated definition of __test_capture_signbit)
|
|
|
|
// must be placed before any files that include <cmath> (gtest.h in this case).
|
|
|
|
//
|
|
|
|
// <math.h> is required to define generic macros signbit, isfinite and
|
|
|
|
// several other such functions.
|
|
|
|
//
|
|
|
|
// <cmath> is required to undef declarations of these macros in the global
|
|
|
|
// namespace and make equivalent functions available in namespace std. Our
|
|
|
|
// stlport implementation does this only for signbit, isfinite, isinf and
|
|
|
|
// isnan.
|
|
|
|
//
|
|
|
|
// NOTE: We don't write our test using std::signbit because we want to be
|
|
|
|
// sure that we're testing the bionic version of signbit. The C++ libraries
|
|
|
|
// are free to reimplement signbit or delegate to compiler builtins if they
|
|
|
|
// please.
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
template<typename T> inline int test_capture_signbit(const T in) {
|
|
|
|
return signbit(in);
|
|
|
|
}
|
|
|
|
template<typename T> inline int test_capture_isfinite(const T in) {
|
|
|
|
return isfinite(in);
|
|
|
|
}
|
|
|
|
template<typename T> inline int test_capture_isnan(const T in) {
|
|
|
|
return isnan(in);
|
|
|
|
}
|
|
|
|
template<typename T> inline int test_capture_isinf(const T in) {
|
|
|
|
return isinf(in);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
#include <fenv.h>
|
2014-03-25 00:45:18 +01:00
|
|
|
#include <float.h>
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
#include <limits.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
float float_subnormal() {
|
|
|
|
union {
|
|
|
|
float f;
|
|
|
|
uint32_t i;
|
|
|
|
} u;
|
|
|
|
u.i = 0x007fffff;
|
|
|
|
return u.f;
|
|
|
|
}
|
|
|
|
|
|
|
|
double double_subnormal() {
|
|
|
|
union {
|
|
|
|
double d;
|
|
|
|
uint64_t i;
|
|
|
|
} u;
|
2013-02-13 05:18:49 +01:00
|
|
|
u.i = 0x000fffffffffffffLL;
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
return u.d;
|
|
|
|
}
|
|
|
|
|
2014-03-14 18:56:46 +01:00
|
|
|
long double ldouble_subnormal() {
|
|
|
|
union {
|
|
|
|
long double e;
|
|
|
|
unsigned char c[sizeof(long double)];
|
|
|
|
} u;
|
|
|
|
|
|
|
|
// Subnormals must have a zero exponent and non zero significand.
|
|
|
|
// On all supported representation the 17 bit (counting from either sides)
|
|
|
|
// is part of the significand so it should be enough to set that.
|
|
|
|
// It also applies for the case sizeof(double) = sizeof(long double)
|
|
|
|
for (unsigned int i = 0; i < sizeof(long double); i++) {
|
|
|
|
u.c[i] = 0x00;
|
|
|
|
}
|
|
|
|
u.c[sizeof(long double) - 3] = 0x80;
|
|
|
|
u.c[2] = 0x80;
|
|
|
|
|
|
|
|
return u.e;
|
|
|
|
}
|
|
|
|
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
TEST(math, fpclassify) {
|
|
|
|
ASSERT_EQ(FP_INFINITE, fpclassify(INFINITY));
|
|
|
|
ASSERT_EQ(FP_INFINITE, fpclassify(HUGE_VALF));
|
|
|
|
ASSERT_EQ(FP_INFINITE, fpclassify(HUGE_VAL));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(FP_INFINITE, fpclassify(HUGE_VALL));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
|
|
|
|
ASSERT_EQ(FP_NAN, fpclassify(nanf("")));
|
|
|
|
ASSERT_EQ(FP_NAN, fpclassify(nan("")));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(FP_NAN, fpclassify(nanl("")));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
|
|
|
|
ASSERT_EQ(FP_NORMAL, fpclassify(1.0f));
|
|
|
|
ASSERT_EQ(FP_NORMAL, fpclassify(1.0));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(FP_NORMAL, fpclassify(1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
|
|
|
|
ASSERT_EQ(FP_SUBNORMAL, fpclassify(float_subnormal()));
|
|
|
|
ASSERT_EQ(FP_SUBNORMAL, fpclassify(double_subnormal()));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(FP_SUBNORMAL, fpclassify(ldouble_subnormal()));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
|
|
|
|
ASSERT_EQ(FP_ZERO, fpclassify(0.0f));
|
|
|
|
ASSERT_EQ(FP_ZERO, fpclassify(0.0));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(FP_ZERO, fpclassify(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, isfinite) {
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_TRUE(test_capture_isfinite(123.0f));
|
|
|
|
ASSERT_TRUE(test_capture_isfinite(123.0));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_TRUE(test_capture_isfinite(123.0l));
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_FALSE(test_capture_isfinite(HUGE_VALF));
|
|
|
|
ASSERT_FALSE(test_capture_isfinite(HUGE_VAL));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_FALSE(test_capture_isfinite(HUGE_VALL));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, isinf) {
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_FALSE(test_capture_isinf(123.0f));
|
|
|
|
ASSERT_FALSE(test_capture_isinf(123.0));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_FALSE(test_capture_isinf(123.0l));
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_TRUE(test_capture_isinf(HUGE_VALF));
|
|
|
|
ASSERT_TRUE(test_capture_isinf(HUGE_VAL));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_TRUE(test_capture_isinf(HUGE_VALL));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, isnan) {
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_FALSE(test_capture_isnan(123.0f));
|
|
|
|
ASSERT_FALSE(test_capture_isnan(123.0));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_FALSE(test_capture_isnan(123.0l));
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_TRUE(test_capture_isnan(nanf("")));
|
|
|
|
ASSERT_TRUE(test_capture_isnan(nan("")));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_TRUE(test_capture_isnan(nanl("")));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, isnormal) {
|
|
|
|
ASSERT_TRUE(isnormal(123.0f));
|
|
|
|
ASSERT_TRUE(isnormal(123.0));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_TRUE(isnormal(123.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_FALSE(isnormal(float_subnormal()));
|
|
|
|
ASSERT_FALSE(isnormal(double_subnormal()));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_FALSE(isnormal(ldouble_subnormal()));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: isgreater, isgreaterequals, isless, islessequal, islessgreater, isunordered
|
|
|
|
TEST(math, signbit) {
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_EQ(0, test_capture_signbit(0.0f));
|
|
|
|
ASSERT_EQ(0, test_capture_signbit(0.0));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(0, test_capture_signbit(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_EQ(0, test_capture_signbit(1.0f));
|
|
|
|
ASSERT_EQ(0, test_capture_signbit(1.0));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(0, test_capture_signbit(1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_NE(0, test_capture_signbit(-1.0f));
|
|
|
|
ASSERT_NE(0, test_capture_signbit(-1.0));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_NE(0, test_capture_signbit(-1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __fpclassifyd) {
|
2013-12-21 03:43:21 +01:00
|
|
|
#if defined(__BIONIC__)
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_EQ(FP_INFINITE, __fpclassifyd(HUGE_VAL));
|
|
|
|
ASSERT_EQ(FP_NAN, __fpclassifyd(nan("")));
|
|
|
|
ASSERT_EQ(FP_NORMAL, __fpclassifyd(1.0));
|
|
|
|
ASSERT_EQ(FP_SUBNORMAL, __fpclassifyd(double_subnormal()));
|
|
|
|
ASSERT_EQ(FP_ZERO, __fpclassifyd(0.0));
|
2013-12-21 03:43:21 +01:00
|
|
|
#else // __BIONIC__
|
|
|
|
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
|
|
|
#endif // __BIONIC__
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __fpclassifyf) {
|
2013-12-21 03:43:21 +01:00
|
|
|
#if defined(__BIONIC__)
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_EQ(FP_INFINITE, __fpclassifyf(HUGE_VALF));
|
|
|
|
ASSERT_EQ(FP_NAN, __fpclassifyf(nanf("")));
|
|
|
|
ASSERT_EQ(FP_NORMAL, __fpclassifyf(1.0f));
|
|
|
|
ASSERT_EQ(FP_SUBNORMAL, __fpclassifyf(float_subnormal()));
|
|
|
|
ASSERT_EQ(FP_ZERO, __fpclassifyf(0.0f));
|
2013-12-21 03:43:21 +01:00
|
|
|
#else // __BIONIC__
|
|
|
|
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
|
|
|
#endif // __BIONIC__
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __fpclassifyl) {
|
2013-12-21 03:43:21 +01:00
|
|
|
#if defined(__BIONIC__)
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
EXPECT_EQ(FP_INFINITE, __fpclassifyl(HUGE_VALL));
|
|
|
|
EXPECT_EQ(FP_NAN, __fpclassifyl(nanl("")));
|
2014-03-14 18:56:46 +01:00
|
|
|
EXPECT_EQ(FP_NORMAL, __fpclassifyl(1.0l));
|
|
|
|
EXPECT_EQ(FP_SUBNORMAL, __fpclassifyl(ldouble_subnormal()));
|
|
|
|
EXPECT_EQ(FP_ZERO, __fpclassifyl(0.0l));
|
2013-12-21 03:43:21 +01:00
|
|
|
#else // __BIONIC__
|
|
|
|
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
|
|
|
#endif // __BIONIC__
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, finitef) {
|
|
|
|
ASSERT_TRUE(finitef(123.0f));
|
|
|
|
ASSERT_FALSE(finitef(HUGE_VALF));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __isfinite) {
|
2013-12-21 03:43:21 +01:00
|
|
|
#if defined(__BIONIC__)
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE(__isfinite(123.0));
|
|
|
|
ASSERT_FALSE(__isfinite(HUGE_VAL));
|
2013-12-21 03:43:21 +01:00
|
|
|
#else // __BIONIC__
|
|
|
|
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
|
|
|
#endif // __BIONIC__
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __isfinitef) {
|
2013-12-21 03:43:21 +01:00
|
|
|
#if defined(__BIONIC__)
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE(__isfinitef(123.0f));
|
|
|
|
ASSERT_FALSE(__isfinitef(HUGE_VALF));
|
2013-12-21 03:43:21 +01:00
|
|
|
#else // __BIONIC__
|
|
|
|
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
|
|
|
#endif // __BIONIC__
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __isfinitel) {
|
2013-12-21 03:43:21 +01:00
|
|
|
#if defined(__BIONIC__)
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_TRUE(__isfinitel(123.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_FALSE(__isfinitel(HUGE_VALL));
|
2013-12-21 03:43:21 +01:00
|
|
|
#else // __BIONIC__
|
|
|
|
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
|
|
|
#endif // __BIONIC__
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, finite) {
|
|
|
|
ASSERT_TRUE(finite(123.0));
|
|
|
|
ASSERT_FALSE(finite(HUGE_VAL));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __isinff) {
|
|
|
|
ASSERT_FALSE(__isinff(123.0f));
|
|
|
|
ASSERT_TRUE(__isinff(HUGE_VALF));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __isinfl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_FALSE(__isinfl(123.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE(__isinfl(HUGE_VALL));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __isnanf) {
|
|
|
|
ASSERT_FALSE(__isnanf(123.0f));
|
|
|
|
ASSERT_TRUE(__isnanf(nanf("")));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __isnanl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_FALSE(__isnanl(123.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE(__isnanl(nanl("")));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, isnanf) {
|
|
|
|
ASSERT_FALSE(isnanf(123.0f));
|
|
|
|
ASSERT_TRUE(isnanf(nanf("")));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __isnormal) {
|
2013-12-21 03:43:21 +01:00
|
|
|
#if defined(__BIONIC__)
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE(__isnormal(123.0));
|
|
|
|
ASSERT_FALSE(__isnormal(double_subnormal()));
|
2013-12-21 03:43:21 +01:00
|
|
|
#else // __BIONIC__
|
|
|
|
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
|
|
|
#endif // __BIONIC__
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __isnormalf) {
|
2013-12-21 03:43:21 +01:00
|
|
|
#if defined(__BIONIC__)
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE(__isnormalf(123.0f));
|
|
|
|
ASSERT_FALSE(__isnormalf(float_subnormal()));
|
2013-12-21 03:43:21 +01:00
|
|
|
#else // __BIONIC__
|
|
|
|
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
|
|
|
#endif // __BIONIC__
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __isnormall) {
|
2013-12-21 03:43:21 +01:00
|
|
|
#if defined(__BIONIC__)
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_TRUE(__isnormall(123.0l));
|
|
|
|
ASSERT_FALSE(__isnormall(ldouble_subnormal()));
|
2013-12-21 03:43:21 +01:00
|
|
|
#else // __BIONIC__
|
|
|
|
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
|
|
|
#endif // __BIONIC__
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __signbit) {
|
|
|
|
ASSERT_EQ(0, __signbit(0.0));
|
|
|
|
ASSERT_EQ(0, __signbit(1.0));
|
|
|
|
ASSERT_NE(0, __signbit(-1.0));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __signbitf) {
|
|
|
|
ASSERT_EQ(0, __signbitf(0.0f));
|
|
|
|
ASSERT_EQ(0, __signbitf(1.0f));
|
|
|
|
ASSERT_NE(0, __signbitf(-1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, __signbitl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(0l, __signbitl(0.0l));
|
|
|
|
ASSERT_EQ(0l, __signbitl(1.0l));
|
|
|
|
ASSERT_NE(0l, __signbitl(-1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, acos) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(M_PI/2.0, acos(0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, acosf) {
|
|
|
|
ASSERT_FLOAT_EQ(static_cast<float>(M_PI)/2.0f, acosf(0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, acosl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(M_PI/2.0l, acosl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, asin) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, asin(0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, asinf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, asinf(0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, asinl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, asinl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, atan) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, atan(0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, atanf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, atanf(0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, atanl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, atanl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, atan2) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, atan2(0.0, 0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, atan2f) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, atan2f(0.0f, 0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, atan2l) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, atan2l(0.0l, 0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, cos) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, cos(0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, cosf) {
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, cosf(0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, cosl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0l, cosl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, sin) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0, sin(0.0));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, sinf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, sinf(0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, sinl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, sinl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, tan) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, tan(0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, tanf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, tanf(0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, tanl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, tanl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, acosh) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, acosh(1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, acoshf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, acoshf(1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, acoshl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, acoshl(1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, asinh) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, asinh(0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, asinhf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, asinhf(0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, asinhl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, asinhl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, atanh) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, atanh(0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, atanhf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, atanhf(0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, atanhl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, atanhl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, cosh) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, cosh(0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, coshf) {
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, coshf(0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, coshl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0l, coshl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, sinh) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, sinh(0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, sinhf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, sinhf(0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, sinhl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, sinhl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, tanh) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, tanh(0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, tanhf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, tanhf(0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, tanhl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, tanhl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, log) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, log(M_E));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, logf) {
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, logf(static_cast<float>(M_E)));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, logl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0l, logl(M_E));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, log2) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(12.0, log2(4096.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, log2f) {
|
|
|
|
ASSERT_FLOAT_EQ(12.0f, log2f(4096.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, log2l) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(12.0l, log2l(4096.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, log10) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(3.0, log10(1000.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, log10f) {
|
|
|
|
ASSERT_FLOAT_EQ(3.0f, log10f(1000.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, log10l) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(3.0l, log10l(1000.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, cbrt) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(3.0, cbrt(27.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, cbrtf) {
|
|
|
|
ASSERT_FLOAT_EQ(3.0f, cbrtf(27.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, cbrtl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(3.0l, cbrtl(27.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, sqrt) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(2.0, sqrt(4.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, sqrtf) {
|
|
|
|
ASSERT_FLOAT_EQ(2.0f, sqrtf(4.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, sqrtl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(2.0l, sqrtl(4.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, exp) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, exp(0.0));
|
|
|
|
ASSERT_DOUBLE_EQ(M_E, exp(1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, expf) {
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, expf(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(static_cast<float>(M_E), expf(1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, expl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0l, expl(0.0l));
|
|
|
|
ASSERT_DOUBLE_EQ(M_E, expl(1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, exp2) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(8.0, exp2(3.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, exp2f) {
|
|
|
|
ASSERT_FLOAT_EQ(8.0f, exp2f(3.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, exp2l) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(8.0l, exp2l(3.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, expm1) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(M_E - 1.0, expm1(1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, expm1f) {
|
|
|
|
ASSERT_FLOAT_EQ(static_cast<float>(M_E) - 1.0f, expm1f(1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, expm1l) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(M_E - 1.0l, expm1l(1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, pow) {
|
2013-11-13 22:29:23 +01:00
|
|
|
ASSERT_TRUE(isnan(pow(nan(""), 3.0)));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, (pow(1.0, nan(""))));
|
2013-11-13 22:29:23 +01:00
|
|
|
ASSERT_TRUE(isnan(pow(2.0, nan(""))));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(8.0, pow(2.0, 3.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, powf) {
|
2013-11-13 22:29:23 +01:00
|
|
|
ASSERT_TRUE(isnanf(powf(nanf(""), 3.0f)));
|
2013-11-18 19:47:48 +01:00
|
|
|
ASSERT_FLOAT_EQ(1.0f, (powf(1.0f, nanf(""))));
|
2013-11-13 22:29:23 +01:00
|
|
|
ASSERT_TRUE(isnanf(powf(2.0f, nanf(""))));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_FLOAT_EQ(8.0f, powf(2.0f, 3.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, powl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_TRUE(__isnanl(powl(nanl(""), 3.0l)));
|
|
|
|
ASSERT_DOUBLE_EQ(1.0l, (powl(1.0l, nanl(""))));
|
|
|
|
ASSERT_TRUE(__isnanl(powl(2.0l, nanl(""))));
|
|
|
|
ASSERT_DOUBLE_EQ(8.0l, powl(2.0l, 3.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, ceil) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, ceil(0.9));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, ceilf) {
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, ceilf(0.9f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, ceill) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, ceill(0.9l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, floor) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, floor(1.1));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, floorf) {
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, floorf(1.1f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, floorl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0l, floorl(1.1l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fabs) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, fabs(-1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fabsf) {
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, fabsf(-1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fabsl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0l, fabsl(-1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, ldexp) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(16.0, ldexp(2.0, 3.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, ldexpf) {
|
|
|
|
ASSERT_FLOAT_EQ(16.0f, ldexpf(2.0f, 3.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, ldexpl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(16.0l, ldexpl(2.0l, 3.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fmod) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(2.0, fmod(12.0, 10.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fmodf) {
|
|
|
|
ASSERT_FLOAT_EQ(2.0f, fmodf(12.0f, 10.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fmodl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(2.0l, fmodl(12.0l, 10.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, remainder) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(2.0, remainder(12.0, 10.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, remainderf) {
|
|
|
|
ASSERT_FLOAT_EQ(2.0f, remainderf(12.0f, 10.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, remainderl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(2.0l, remainderl(12.0l, 10.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, drem) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(2.0, drem(12.0, 10.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, dremf) {
|
|
|
|
ASSERT_FLOAT_EQ(2.0f, dremf(12.0f, 10.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fmax) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(12.0, fmax(12.0, 10.0));
|
|
|
|
ASSERT_DOUBLE_EQ(12.0, fmax(12.0, nan("")));
|
|
|
|
ASSERT_DOUBLE_EQ(12.0, fmax(nan(""), 12.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fmaxf) {
|
|
|
|
ASSERT_FLOAT_EQ(12.0f, fmaxf(12.0f, 10.0f));
|
|
|
|
ASSERT_FLOAT_EQ(12.0f, fmaxf(12.0f, nanf("")));
|
|
|
|
ASSERT_FLOAT_EQ(12.0f, fmaxf(nanf(""), 12.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fmaxl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(12.0l, fmaxl(12.0l, 10.0l));
|
|
|
|
ASSERT_DOUBLE_EQ(12.0l, fmaxl(12.0l, nanl("")));
|
|
|
|
ASSERT_DOUBLE_EQ(12.0l, fmaxl(nanl(""), 12.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fmin) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(10.0, fmin(12.0, 10.0));
|
|
|
|
ASSERT_DOUBLE_EQ(12.0, fmin(12.0, nan("")));
|
|
|
|
ASSERT_DOUBLE_EQ(12.0, fmin(nan(""), 12.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fminf) {
|
|
|
|
ASSERT_FLOAT_EQ(10.0f, fminf(12.0f, 10.0f));
|
|
|
|
ASSERT_FLOAT_EQ(12.0f, fminf(12.0f, nanf("")));
|
|
|
|
ASSERT_FLOAT_EQ(12.0f, fminf(nanf(""), 12.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fminl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(10.0l, fminl(12.0l, 10.0l));
|
|
|
|
ASSERT_DOUBLE_EQ(12.0l, fminl(12.0l, nanl("")));
|
|
|
|
ASSERT_DOUBLE_EQ(12.0l, fminl(nanl(""), 12.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fma) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(10.0, fma(2.0, 3.0, 4.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fmaf) {
|
|
|
|
ASSERT_FLOAT_EQ(10.0f, fmaf(2.0f, 3.0f, 4.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fmal) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(10.0l, fmal(2.0l, 3.0l, 4.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, hypot) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(5.0, hypot(3.0, 4.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, hypotf) {
|
|
|
|
ASSERT_FLOAT_EQ(5.0f, hypotf(3.0f, 4.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, hypotl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(5.0l, hypotl(3.0l, 4.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, erf) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.84270079294971489, erf(1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, erff) {
|
|
|
|
ASSERT_FLOAT_EQ(0.84270078f, erff(1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, erfl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.84270079294971489l, erfl(1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, erfc) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.15729920705028513, erfc(1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, erfcf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.15729921f, erfcf(1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, erfcl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.15729920705028513l, erfcl(1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, lrint) {
|
|
|
|
fesetround(FE_UPWARD); // lrint/lrintf/lrintl obey the rounding mode.
|
|
|
|
ASSERT_EQ(1235, lrint(1234.01));
|
|
|
|
ASSERT_EQ(1235, lrintf(1234.01f));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(1235, lrintl(1234.01l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
fesetround(FE_TOWARDZERO); // lrint/lrintf/lrintl obey the rounding mode.
|
|
|
|
ASSERT_EQ(1234, lrint(1234.01));
|
|
|
|
ASSERT_EQ(1234, lrintf(1234.01f));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(1234, lrintl(1234.01l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
|
|
|
|
fesetround(FE_UPWARD); // llrint/llrintf/llrintl obey the rounding mode.
|
|
|
|
ASSERT_EQ(1235L, llrint(1234.01));
|
|
|
|
ASSERT_EQ(1235L, llrintf(1234.01f));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(1235L, llrintl(1234.01l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
fesetround(FE_TOWARDZERO); // llrint/llrintf/llrintl obey the rounding mode.
|
|
|
|
ASSERT_EQ(1234L, llrint(1234.01));
|
|
|
|
ASSERT_EQ(1234L, llrintf(1234.01f));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(1234L, llrintl(1234.01l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, rint) {
|
|
|
|
fesetround(FE_UPWARD); // rint/rintf/rintl obey the rounding mode.
|
|
|
|
feclearexcept(FE_ALL_EXCEPT); // rint/rintf/rintl do set the FE_INEXACT flag.
|
|
|
|
ASSERT_EQ(1234.0, rint(1234.0));
|
|
|
|
ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
|
|
|
|
ASSERT_EQ(1235.0, rint(1234.01));
|
|
|
|
ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) != 0);
|
|
|
|
|
|
|
|
feclearexcept(FE_ALL_EXCEPT); // rint/rintf/rintl do set the FE_INEXACT flag.
|
|
|
|
ASSERT_EQ(1234.0f, rintf(1234.0f));
|
|
|
|
ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
|
|
|
|
ASSERT_EQ(1235.0f, rintf(1234.01f));
|
|
|
|
ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) != 0);
|
|
|
|
|
|
|
|
feclearexcept(FE_ALL_EXCEPT); // rint/rintf/rintl do set the FE_INEXACT flag.
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(1234.0, rintl(1234.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(1235.0, rintl(1234.01l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) != 0);
|
|
|
|
|
|
|
|
fesetround(FE_TOWARDZERO); // rint/rintf obey the rounding mode.
|
|
|
|
ASSERT_EQ(1234.0, rint(1234.01));
|
|
|
|
ASSERT_EQ(1234.0f, rintf(1234.01f));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(1234.0, rintl(1234.01l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, nearbyint) {
|
|
|
|
fesetround(FE_UPWARD); // nearbyint/nearbyintf/nearbyintl obey the rounding mode.
|
|
|
|
feclearexcept(FE_ALL_EXCEPT); // nearbyint/nearbyintf/nearbyintl don't set the FE_INEXACT flag.
|
|
|
|
ASSERT_EQ(1234.0, nearbyint(1234.0));
|
|
|
|
ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
|
|
|
|
ASSERT_EQ(1235.0, nearbyint(1234.01));
|
|
|
|
ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
|
|
|
|
|
|
|
|
feclearexcept(FE_ALL_EXCEPT);
|
|
|
|
ASSERT_EQ(1234.0f, nearbyintf(1234.0f));
|
|
|
|
ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
|
|
|
|
ASSERT_EQ(1235.0f, nearbyintf(1234.01f));
|
|
|
|
ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
|
|
|
|
|
|
|
|
feclearexcept(FE_ALL_EXCEPT); // nearbyint/nearbyintf/nearbyintl don't set the FE_INEXACT flag.
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(1234.0, nearbyintl(1234.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(1235.0, nearbyintl(1234.01l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
|
|
|
|
|
|
|
|
fesetround(FE_TOWARDZERO); // nearbyint/nearbyintf/nearbyintl obey the rounding mode.
|
|
|
|
ASSERT_EQ(1234.0, nearbyint(1234.01));
|
|
|
|
ASSERT_EQ(1234.0f, nearbyintf(1234.01f));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(1234.0, nearbyintl(1234.01l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, lround) {
|
|
|
|
fesetround(FE_UPWARD); // lround ignores the rounding mode.
|
|
|
|
ASSERT_EQ(1234, lround(1234.01));
|
|
|
|
ASSERT_EQ(1234, lroundf(1234.01f));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(1234, lroundl(1234.01l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, llround) {
|
|
|
|
fesetround(FE_UPWARD); // llround ignores the rounding mode.
|
|
|
|
ASSERT_EQ(1234L, llround(1234.01));
|
|
|
|
ASSERT_EQ(1234L, llroundf(1234.01f));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(1234L, llroundl(1234.01l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, ilogb) {
|
|
|
|
ASSERT_EQ(FP_ILOGB0, ilogb(0.0));
|
|
|
|
ASSERT_EQ(FP_ILOGBNAN, ilogb(nan("")));
|
|
|
|
ASSERT_EQ(INT_MAX, ilogb(HUGE_VAL));
|
|
|
|
ASSERT_EQ(0, ilogb(1.0));
|
|
|
|
ASSERT_EQ(3, ilogb(10.0));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, ilogbf) {
|
|
|
|
ASSERT_EQ(FP_ILOGB0, ilogbf(0.0f));
|
|
|
|
ASSERT_EQ(FP_ILOGBNAN, ilogbf(nanf("")));
|
|
|
|
ASSERT_EQ(INT_MAX, ilogbf(HUGE_VALF));
|
|
|
|
ASSERT_EQ(0, ilogbf(1.0f));
|
|
|
|
ASSERT_EQ(3, ilogbf(10.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, ilogbl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(FP_ILOGB0, ilogbl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_EQ(FP_ILOGBNAN, ilogbl(nanl("")));
|
|
|
|
ASSERT_EQ(INT_MAX, ilogbl(HUGE_VALL));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(0l, ilogbl(1.0l));
|
|
|
|
ASSERT_EQ(3l, ilogbl(10.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, logb) {
|
|
|
|
ASSERT_EQ(-HUGE_VAL, logb(0.0));
|
|
|
|
ASSERT_TRUE(isnan(logb(nan(""))));
|
|
|
|
ASSERT_TRUE(isinf(logb(HUGE_VAL)));
|
|
|
|
ASSERT_EQ(0.0, logb(1.0));
|
|
|
|
ASSERT_EQ(3.0, logb(10.0));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, logbf) {
|
|
|
|
ASSERT_EQ(-HUGE_VALF, logbf(0.0f));
|
|
|
|
ASSERT_TRUE(isnanf(logbf(nanf(""))));
|
|
|
|
ASSERT_TRUE(__isinff(logbf(HUGE_VALF)));
|
|
|
|
ASSERT_EQ(0.0f, logbf(1.0f));
|
|
|
|
ASSERT_EQ(3.0f, logbf(10.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, logbl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(-HUGE_VAL, logbl(0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE(isnan(logbl(nanl(""))));
|
|
|
|
ASSERT_TRUE(isinf(logbl(HUGE_VALL)));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(0.0l, logbl(1.0l));
|
|
|
|
ASSERT_EQ(3.0l, logbl(10.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, log1p) {
|
|
|
|
ASSERT_EQ(-HUGE_VAL, log1p(-1.0));
|
|
|
|
ASSERT_TRUE(isnan(log1p(nan(""))));
|
|
|
|
ASSERT_TRUE(isinf(log1p(HUGE_VAL)));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, log1p(M_E - 1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, log1pf) {
|
|
|
|
ASSERT_EQ(-HUGE_VALF, log1pf(-1.0f));
|
|
|
|
ASSERT_TRUE(isnanf(log1pf(nanf(""))));
|
|
|
|
ASSERT_TRUE(__isinff(log1pf(HUGE_VALF)));
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, log1pf(static_cast<float>(M_E) - 1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, log1pl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(-HUGE_VALL, log1pl(-1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE(isnan(log1pl(nanl(""))));
|
|
|
|
ASSERT_TRUE(isinf(log1pl(HUGE_VALL)));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0l, log1pl(M_E - 1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fdim) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, fdim(1.0, 1.0));
|
|
|
|
ASSERT_DOUBLE_EQ(1.0, fdim(2.0, 1.0));
|
|
|
|
ASSERT_DOUBLE_EQ(0.0, fdim(1.0, 2.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fdimf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, fdimf(1.0f, 1.0f));
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, fdimf(2.0f, 1.0f));
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, fdimf(1.0f, 2.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, fdiml) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, fdiml(1.0l, 1.0l));
|
|
|
|
ASSERT_DOUBLE_EQ(1.0l, fdiml(2.0l, 1.0l));
|
|
|
|
ASSERT_DOUBLE_EQ(0.0l, fdiml(1.0l, 2.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, round) {
|
|
|
|
fesetround(FE_TOWARDZERO); // round ignores the rounding mode and always rounds away from zero.
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, round(0.5));
|
|
|
|
ASSERT_DOUBLE_EQ(-1.0, round(-0.5));
|
|
|
|
ASSERT_DOUBLE_EQ(0.0, round(0.0));
|
|
|
|
ASSERT_DOUBLE_EQ(-0.0, round(-0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE(isnan(round(nan(""))));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(HUGE_VAL, round(HUGE_VAL));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, roundf) {
|
|
|
|
fesetround(FE_TOWARDZERO); // roundf ignores the rounding mode and always rounds away from zero.
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, roundf(0.5f));
|
|
|
|
ASSERT_FLOAT_EQ(-1.0f, roundf(-0.5f));
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, roundf(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(-0.0f, roundf(-0.0f));
|
|
|
|
ASSERT_TRUE(isnanf(roundf(nanf(""))));
|
|
|
|
ASSERT_FLOAT_EQ(HUGE_VALF, roundf(HUGE_VALF));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, roundl) {
|
|
|
|
fesetround(FE_TOWARDZERO); // roundl ignores the rounding mode and always rounds away from zero.
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0l, roundl(0.5l));
|
|
|
|
ASSERT_DOUBLE_EQ(-1.0l, roundl(-0.5l));
|
|
|
|
ASSERT_DOUBLE_EQ(0.0l, roundl(0.0l));
|
|
|
|
ASSERT_DOUBLE_EQ(-0.0l, roundl(-0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE(isnan(roundl(nanl(""))));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(HUGE_VALL, roundl(HUGE_VALL));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, trunc) {
|
|
|
|
fesetround(FE_UPWARD); // trunc ignores the rounding mode and always rounds toward zero.
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, trunc(1.5));
|
|
|
|
ASSERT_DOUBLE_EQ(-1.0, trunc(-1.5));
|
|
|
|
ASSERT_DOUBLE_EQ(0.0, trunc(0.0));
|
|
|
|
ASSERT_DOUBLE_EQ(-0.0, trunc(-0.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE(isnan(trunc(nan(""))));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(HUGE_VAL, trunc(HUGE_VAL));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, truncf) {
|
|
|
|
fesetround(FE_UPWARD); // truncf ignores the rounding mode and always rounds toward zero.
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, truncf(1.5f));
|
|
|
|
ASSERT_FLOAT_EQ(-1.0f, truncf(-1.5f));
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, truncf(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(-0.0f, truncf(-0.0f));
|
|
|
|
ASSERT_TRUE(isnan(truncf(nanf(""))));
|
|
|
|
ASSERT_FLOAT_EQ(HUGE_VALF, truncf(HUGE_VALF));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, truncl) {
|
|
|
|
fesetround(FE_UPWARD); // truncl ignores the rounding mode and always rounds toward zero.
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0l, truncl(1.5l));
|
|
|
|
ASSERT_DOUBLE_EQ(-1.0l, truncl(-1.5l));
|
|
|
|
ASSERT_DOUBLE_EQ(0.0l, truncl(0.0l));
|
|
|
|
ASSERT_DOUBLE_EQ(-0.0l, truncl(-0.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_TRUE(isnan(truncl(nan(""))));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(HUGE_VALL, truncl(HUGE_VALL));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, nextafter) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, nextafter(0.0, 0.0));
|
|
|
|
ASSERT_DOUBLE_EQ(4.9406564584124654e-324, nextafter(0.0, 1.0));
|
|
|
|
ASSERT_DOUBLE_EQ(0.0, nextafter(0.0, -1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, nextafterf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, nextafterf(0.0f, 0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(1.4012985e-45f, nextafterf(0.0f, 1.0f));
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, nextafterf(0.0f, -1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, nextafterl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, nextafterl(0.0l, 0.0l));
|
|
|
|
// Use a runtime value to accomodate the case when
|
|
|
|
// sizeof(double) == sizeof(long double)
|
|
|
|
long double smallest_positive = ldexpl(1.0l, LDBL_MIN_EXP - LDBL_MANT_DIG);
|
|
|
|
ASSERT_DOUBLE_EQ(smallest_positive, nextafterl(0.0l, 1.0l));
|
|
|
|
ASSERT_DOUBLE_EQ(0.0l, nextafterl(0.0l, -1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: nexttoward
|
|
|
|
// TODO: nexttowardf
|
|
|
|
// TODO: nexttowardl
|
|
|
|
|
|
|
|
TEST(math, copysign) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, copysign(0.0, 1.0));
|
|
|
|
ASSERT_DOUBLE_EQ(-0.0, copysign(0.0, -1.0));
|
|
|
|
ASSERT_DOUBLE_EQ(2.0, copysign(2.0, 1.0));
|
|
|
|
ASSERT_DOUBLE_EQ(-2.0, copysign(2.0, -1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, copysignf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, copysignf(0.0f, 1.0f));
|
|
|
|
ASSERT_FLOAT_EQ(-0.0f, copysignf(0.0f, -1.0f));
|
|
|
|
ASSERT_FLOAT_EQ(2.0f, copysignf(2.0f, 1.0f));
|
|
|
|
ASSERT_FLOAT_EQ(-2.0f, copysignf(2.0f, -1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, copysignl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, copysignl(0.0l, 1.0l));
|
|
|
|
ASSERT_DOUBLE_EQ(-0.0l, copysignl(0.0l, -1.0l));
|
|
|
|
ASSERT_DOUBLE_EQ(2.0l, copysignl(2.0l, 1.0l));
|
|
|
|
ASSERT_DOUBLE_EQ(-2.0l, copysignl(2.0l, -1.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, significand) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, significand(0.0));
|
|
|
|
ASSERT_DOUBLE_EQ(1.2, significand(1.2));
|
|
|
|
ASSERT_DOUBLE_EQ(1.5375, significand(12.3));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, significandf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, significandf(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(1.2f, significandf(1.2f));
|
|
|
|
ASSERT_FLOAT_EQ(1.5375f, significandf(12.3f));
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" long double significandl(long double); // BSD's <math.h> doesn't declare this.
|
|
|
|
|
|
|
|
TEST(math, significandl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0l, significandl(0.0l));
|
|
|
|
ASSERT_DOUBLE_EQ(1.2l, significandl(1.2l));
|
|
|
|
ASSERT_DOUBLE_EQ(1.5375l, significandl(12.3l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, scalb) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(12.0, scalb(3.0, 2.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, scalbf) {
|
|
|
|
ASSERT_FLOAT_EQ(12.0f, scalbf(3.0f, 2.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, scalbln) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(12.0, scalbln(3.0, 2L));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, scalblnf) {
|
|
|
|
ASSERT_FLOAT_EQ(12.0f, scalblnf(3.0f, 2L));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, scalblnl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(12.0l, scalblnl(3.0l, 2L));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, scalbn) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(12.0, scalbn(3.0, 2));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, scalbnf) {
|
|
|
|
ASSERT_FLOAT_EQ(12.0f, scalbnf(3.0f, 2));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, scalbnl) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(12.0l, scalbnl(3.0l, 2));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, gamma) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(log(24.0), gamma(5.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, gammaf) {
|
|
|
|
ASSERT_FLOAT_EQ(logf(24.0f), gammaf(5.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, gamma_r) {
|
2013-12-21 03:43:21 +01:00
|
|
|
#if defined(__BIONIC__)
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
int sign;
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(log(24.0), gamma_r(5.0, &sign));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_EQ(1, sign);
|
2013-12-21 03:43:21 +01:00
|
|
|
#else // __BIONIC__
|
|
|
|
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
|
|
|
#endif // __BIONIC__
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, gammaf_r) {
|
2013-12-21 03:43:21 +01:00
|
|
|
#if defined(__BIONIC__)
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
int sign;
|
|
|
|
ASSERT_FLOAT_EQ(logf(24.0f), gammaf_r(5.0f, &sign));
|
|
|
|
ASSERT_EQ(1, sign);
|
2013-12-21 03:43:21 +01:00
|
|
|
#else // __BIONIC__
|
|
|
|
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
|
|
|
#endif // __BIONIC__
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, lgamma) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(log(24.0), lgamma(5.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, lgammaf) {
|
|
|
|
ASSERT_FLOAT_EQ(logf(24.0f), lgammaf(5.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, lgammal) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(logl(24.0l), lgammal(5.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, lgamma_r) {
|
|
|
|
int sign;
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(log(24.0), lgamma_r(5.0, &sign));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_EQ(1, sign);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, lgammaf_r) {
|
|
|
|
int sign;
|
|
|
|
ASSERT_FLOAT_EQ(logf(24.0f), lgammaf_r(5.0f, &sign));
|
|
|
|
ASSERT_EQ(1, sign);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, tgamma) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(24.0, tgamma(5.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, tgammaf) {
|
|
|
|
ASSERT_FLOAT_EQ(24.0f, tgammaf(5.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, tgammal) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(24.0l, tgammal(5.0l));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, j0) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, j0(0.0));
|
|
|
|
ASSERT_DOUBLE_EQ(0.76519768655796661, j0(1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, j0f) {
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, j0f(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(0.76519769f, j0f(1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, j1) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, j1(0.0));
|
|
|
|
ASSERT_DOUBLE_EQ(0.44005058574493355, j1(1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, j1f) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, j1f(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(0.44005057f, j1f(1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, jn) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, jn(4, 0.0));
|
|
|
|
ASSERT_DOUBLE_EQ(0.0024766389641099553, jn(4, 1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, jnf) {
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, jnf(4, 0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(0.0024766389f, jnf(4, 1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, y0) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(-HUGE_VAL, y0(0.0));
|
|
|
|
ASSERT_DOUBLE_EQ(0.08825696421567697, y0(1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, y0f) {
|
|
|
|
ASSERT_FLOAT_EQ(-HUGE_VALF, y0f(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(0.088256963f, y0f(1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, y1) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(-HUGE_VAL, y1(0.0));
|
|
|
|
ASSERT_DOUBLE_EQ(-0.78121282130028868, y1(1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, y1f) {
|
|
|
|
ASSERT_FLOAT_EQ(-HUGE_VALF, y1f(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(-0.78121281f, y1f(1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, yn) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(-HUGE_VAL, yn(4, 0.0));
|
|
|
|
ASSERT_DOUBLE_EQ(-33.278423028972114, yn(4, 1.0));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, ynf) {
|
|
|
|
ASSERT_FLOAT_EQ(-HUGE_VALF, ynf(4, 0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(-33.278423f, ynf(4, 1.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, frexp) {
|
|
|
|
int exp;
|
|
|
|
double dr = frexp(1024.0, &exp);
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1024.0, scalbn(dr, exp));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, frexpf) {
|
|
|
|
int exp;
|
|
|
|
float fr = frexpf(1024.0f, &exp);
|
|
|
|
ASSERT_FLOAT_EQ(1024.0f, scalbnf(fr, exp));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, frexpl) {
|
|
|
|
int exp;
|
2014-03-14 18:56:46 +01:00
|
|
|
long double ldr = frexpl(1024.0l, &exp);
|
|
|
|
ASSERT_DOUBLE_EQ(1024.0l, scalbnl(ldr, exp));
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, modf) {
|
|
|
|
double di;
|
|
|
|
double df = modf(123.456, &di);
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(123.0, di);
|
2014-03-27 14:41:06 +01:00
|
|
|
// ASSERT_DOUBLE uses more decimals than the double precision when performing
|
|
|
|
// the comparison which can result in false failures. And it seems that modf
|
|
|
|
// results are not 100% precise as expected but within the acceptable delta.
|
|
|
|
// Work around this by tweaking the expected value (taken) from the result of
|
|
|
|
// glibc modf).
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(0.45600000000000307, df);
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, modff) {
|
|
|
|
float fi;
|
|
|
|
float ff = modff(123.456f, &fi);
|
|
|
|
ASSERT_FLOAT_EQ(123.0f, fi);
|
2014-03-27 14:41:06 +01:00
|
|
|
// See modf comment on why we don't use 0.456f as an excepted value.
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
ASSERT_FLOAT_EQ(0.45600128f, ff);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, modfl) {
|
|
|
|
long double ldi;
|
2014-03-14 18:56:46 +01:00
|
|
|
long double ldf = modfl(123.456l, &ldi);
|
|
|
|
ASSERT_DOUBLE_EQ(123.0l, ldi);
|
2014-03-27 14:41:06 +01:00
|
|
|
// See modf comment on why we don't use 0.456l as an excepted value when the
|
|
|
|
// modf == modfl. For LP64, where long double != double, modfl algorithm
|
|
|
|
// gives precise results and thus we don't need to tweak the expected value.
|
|
|
|
#if defined(__LP64__) || !defined(__BIONIC__)
|
|
|
|
ASSERT_DOUBLE_EQ(0.456l, ldf);
|
|
|
|
#else
|
|
|
|
ASSERT_DOUBLE_EQ(0.45600000000000307, ldf);
|
|
|
|
#endif // __LP64__ || !__BIONIC__
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, remquo) {
|
|
|
|
int q;
|
|
|
|
double d = remquo(13.0, 4.0, &q);
|
|
|
|
ASSERT_EQ(3, q);
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(1.0, d);
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, remquof) {
|
|
|
|
int q;
|
|
|
|
float f = remquof(13.0f, 4.0f, &q);
|
|
|
|
ASSERT_EQ(3, q);
|
|
|
|
ASSERT_FLOAT_EQ(1.0, f);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(math, remquol) {
|
|
|
|
int q;
|
2014-03-14 18:56:46 +01:00
|
|
|
long double ld = remquol(13.0l, 4.0l, &q);
|
|
|
|
ASSERT_DOUBLE_EQ(3l, q);
|
|
|
|
ASSERT_DOUBLE_EQ(1.0l, ld);
|
Upgrade libm.
This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.
It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).
All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.
Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
2013-01-31 04:06:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// https://code.google.com/p/android/issues/detail?id=6697
|
|
|
|
TEST(math, frexpf_public_bug_6697) {
|
|
|
|
int exp;
|
|
|
|
float fr = frexpf(14.1f, &exp);
|
|
|
|
ASSERT_FLOAT_EQ(14.1f, scalbnf(fr, exp));
|
|
|
|
}
|