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.
|
|
|
|
*/
|
|
|
|
|
2014-11-04 02:03:20 +01:00
|
|
|
#define _GNU_SOURCE 1
|
|
|
|
#include <math.h>
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
#if defined(__BIONIC_LP32_USE_LONG_DOUBLE)
|
|
|
|
#define MATH_TEST math_h_force_long_double
|
|
|
|
#else
|
|
|
|
#define MATH_TEST math_h
|
|
|
|
#endif
|
|
|
|
|
2014-11-04 02:03:20 +01:00
|
|
|
#include "math_data_test.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 <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>
|
|
|
|
|
2017-04-06 01:20:29 +02:00
|
|
|
#include <android-base/scopeguard.h>
|
2014-09-04 21:47:07 +02:00
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
static float float_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
|
|
|
union {
|
|
|
|
float f;
|
|
|
|
uint32_t i;
|
|
|
|
} u;
|
|
|
|
u.i = 0x007fffff;
|
|
|
|
return u.f;
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
static double double_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
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
static long double ldouble_subnormal() {
|
2014-03-14 18:56:46 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fpclassify) {
|
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, fpclassify(INFINITY));
|
|
|
|
ASSERT_EQ(FP_INFINITE, fpclassify(HUGE_VALF));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_EQ(FP_INFINITE, fpclassify(-HUGE_VALF));
|
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, fpclassify(HUGE_VAL));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_EQ(FP_INFINITE, fpclassify(-HUGE_VAL));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_EQ(FP_INFINITE, fpclassify(HUGE_VALL));
|
2018-07-23 23:25:36 +02: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-04-01 17:41:12 +02: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-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, isfinite) {
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_TRUE(test_capture_isfinite(123.0f));
|
|
|
|
ASSERT_TRUE(test_capture_isfinite(123.0));
|
2014-04-01 17:41:12 +02:00
|
|
|
ASSERT_TRUE(test_capture_isfinite(123.0L));
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_FALSE(test_capture_isfinite(HUGE_VALF));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_FALSE(test_capture_isfinite(-HUGE_VALF));
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_FALSE(test_capture_isfinite(HUGE_VAL));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_FALSE(test_capture_isfinite(-HUGE_VAL));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_FALSE(test_capture_isfinite(HUGE_VALL));
|
2018-07-23 23:25:36 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, isinf) {
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_FALSE(test_capture_isinf(123.0f));
|
|
|
|
ASSERT_FALSE(test_capture_isinf(123.0));
|
2014-04-01 17:41:12 +02:00
|
|
|
ASSERT_FALSE(test_capture_isinf(123.0L));
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_TRUE(test_capture_isinf(HUGE_VALF));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(test_capture_isinf(-HUGE_VALF));
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_TRUE(test_capture_isinf(HUGE_VAL));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(test_capture_isinf(-HUGE_VAL));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_TRUE(test_capture_isinf(HUGE_VALL));
|
2018-07-23 23:25:36 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, isnan) {
|
2014-02-19 16:42:58 +01:00
|
|
|
ASSERT_FALSE(test_capture_isnan(123.0f));
|
|
|
|
ASSERT_FALSE(test_capture_isnan(123.0));
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, isnormal) {
|
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.0f));
|
|
|
|
ASSERT_TRUE(isnormal(123.0));
|
2014-04-01 17:41:12 +02: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
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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-04-01 17:41:12 +02: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-04-01 17:41:12 +02: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-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-10-19 22:56:28 +02:00
|
|
|
// Historical BSD cruft that isn't exposed in <math.h> any more.
|
2017-11-02 06:17:26 +01:00
|
|
|
extern "C" int __fpclassify(double);
|
2017-10-19 22:56:28 +02:00
|
|
|
extern "C" int __fpclassifyd(double);
|
|
|
|
extern "C" int __fpclassifyf(float);
|
|
|
|
extern "C" int __fpclassifyl(long double);
|
|
|
|
|
2017-11-02 06:17:26 +01:00
|
|
|
TEST(MATH_TEST, __fpclassify) {
|
|
|
|
ASSERT_EQ(FP_INFINITE, __fpclassify(HUGE_VAL));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_EQ(FP_INFINITE, __fpclassify(-HUGE_VAL));
|
2017-11-02 06:17:26 +01:00
|
|
|
ASSERT_EQ(FP_NAN, __fpclassify(nan("")));
|
|
|
|
ASSERT_EQ(FP_NORMAL, __fpclassify(1.0));
|
|
|
|
ASSERT_EQ(FP_SUBNORMAL, __fpclassify(double_subnormal()));
|
|
|
|
ASSERT_EQ(FP_ZERO, __fpclassify(0.0));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __fpclassifyd) {
|
2014-11-04 02:03:20 +01:00
|
|
|
#if defined(__GLIBC__)
|
|
|
|
#define __fpclassifyd __fpclassify
|
|
|
|
#endif
|
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));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_EQ(FP_INFINITE, __fpclassifyd(-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
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __fpclassifyf) {
|
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));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_EQ(FP_INFINITE, __fpclassifyf(-HUGE_VALF));
|
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, __fpclassifyf(nanf("")));
|
|
|
|
ASSERT_EQ(FP_NORMAL, __fpclassifyf(1.0f));
|
|
|
|
ASSERT_EQ(FP_SUBNORMAL, __fpclassifyf(float_subnormal()));
|
|
|
|
ASSERT_EQ(FP_ZERO, __fpclassifyf(0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __fpclassifyl) {
|
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));
|
2018-07-23 23:25:36 +02:00
|
|
|
EXPECT_EQ(FP_INFINITE, __fpclassifyl(-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
|
|
|
EXPECT_EQ(FP_NAN, __fpclassifyl(nanl("")));
|
2014-04-01 17:41:12 +02:00
|
|
|
EXPECT_EQ(FP_NORMAL, __fpclassifyl(1.0L));
|
2014-03-14 18:56:46 +01:00
|
|
|
EXPECT_EQ(FP_SUBNORMAL, __fpclassifyl(ldouble_subnormal()));
|
2014-04-01 17:41:12 +02:00
|
|
|
EXPECT_EQ(FP_ZERO, __fpclassifyl(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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, finitef) {
|
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(finitef(123.0f));
|
|
|
|
ASSERT_FALSE(finitef(HUGE_VALF));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_FALSE(finitef(-HUGE_VALF));
|
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
|
|
|
}
|
|
|
|
|
2017-10-19 22:56:28 +02:00
|
|
|
// Historical BSD cruft that isn't exposed in <math.h> any more.
|
|
|
|
extern "C" int __isfinite(double);
|
|
|
|
extern "C" int __isfinitef(float);
|
2017-12-21 08:01:26 +01:00
|
|
|
extern "C" int isfinitef(float);
|
2017-10-19 22:56:28 +02:00
|
|
|
extern "C" int __isfinitel(long double);
|
2017-12-21 08:01:26 +01:00
|
|
|
extern "C" int isfinitel(long double);
|
2017-10-19 22:56:28 +02:00
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __isfinite) {
|
2014-11-04 02:03:20 +01:00
|
|
|
#if defined(__GLIBC__)
|
|
|
|
#define __isfinite __finite
|
|
|
|
#endif
|
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));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_FALSE(__isfinite(-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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __isfinitef) {
|
2014-11-04 02:03:20 +01:00
|
|
|
#if defined(__GLIBC__)
|
|
|
|
#define __isfinitef __finitef
|
|
|
|
#endif
|
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));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_FALSE(__isfinitef(-HUGE_VALF));
|
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
|
|
|
}
|
|
|
|
|
2017-12-21 08:01:26 +01:00
|
|
|
TEST(MATH_TEST, isfinitef) {
|
|
|
|
#if defined(__GLIBC__)
|
|
|
|
#define isfinitef __finitef
|
|
|
|
#endif
|
|
|
|
ASSERT_TRUE(isfinitef(123.0f));
|
|
|
|
ASSERT_FALSE(isfinitef(HUGE_VALF));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_FALSE(isfinitef(-HUGE_VALF));
|
2017-12-21 08:01:26 +01:00
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __isfinitel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
#if defined(__GLIBC__)
|
|
|
|
#define __isfinitel __finitel
|
|
|
|
#endif
|
2014-04-01 17:41:12 +02: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));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_FALSE(__isfinitel(-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
|
|
|
}
|
|
|
|
|
2017-12-21 08:01:26 +01:00
|
|
|
TEST(MATH_TEST, isfinitel) {
|
|
|
|
#if defined(__GLIBC__)
|
|
|
|
#define isfinitel __finitel
|
|
|
|
#endif
|
|
|
|
ASSERT_TRUE(isfinitel(123.0L));
|
|
|
|
ASSERT_FALSE(isfinitel(HUGE_VALL));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_FALSE(isfinitel(-HUGE_VALL));
|
2017-12-21 08:01:26 +01:00
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, finite) {
|
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(finite(123.0));
|
|
|
|
ASSERT_FALSE(finite(HUGE_VAL));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_FALSE(finite(-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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, isinf_function) {
|
Reimplement isinf/isnan/fpclassify.
Also move isinf and isnan into libc like everyone else.
Also move fpclassify to libc like the BSDs (but unlike glibc). We need
this to be able to upgrade our float/double/long double parsing to gdtoa.
Also add some missing aliases. We now have all of:
isnan, __isnan, isnanf, __isnanf, isnanl, __isnanl,
isinf, __isinf, isinff, __isinff, isinfl, __isinfl,
__fpclassify, __fpclassifyd, __fpclassifyf, __fpclassifyl.
Bug: 13469877
Change-Id: I407ffbac06c765a6c5fffda8106c37d7db04f27d
2014-04-12 02:02:20 +02:00
|
|
|
// The isinf macro deals with all three types; the isinf function is for doubles.
|
|
|
|
ASSERT_FALSE((isinf)(123.0));
|
|
|
|
ASSERT_TRUE((isinf)(HUGE_VAL));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE((isinf)(-HUGE_VAL));
|
Reimplement isinf/isnan/fpclassify.
Also move isinf and isnan into libc like everyone else.
Also move fpclassify to libc like the BSDs (but unlike glibc). We need
this to be able to upgrade our float/double/long double parsing to gdtoa.
Also add some missing aliases. We now have all of:
isnan, __isnan, isnanf, __isnanf, isnanl, __isnanl,
isinf, __isinf, isinff, __isinff, isinfl, __isinfl,
__fpclassify, __fpclassifyd, __fpclassifyf, __fpclassifyl.
Bug: 13469877
Change-Id: I407ffbac06c765a6c5fffda8106c37d7db04f27d
2014-04-12 02:02:20 +02:00
|
|
|
}
|
|
|
|
|
2017-10-19 22:56:28 +02:00
|
|
|
// Historical BSD cruft that isn't exposed in <math.h> any more.
|
2017-11-02 06:17:26 +01:00
|
|
|
extern "C" int __isinf(double);
|
2017-10-19 22:56:28 +02:00
|
|
|
extern "C" int __isinff(float);
|
2017-12-21 08:01:26 +01:00
|
|
|
extern "C" int isinff(float);
|
2017-10-19 22:56:28 +02:00
|
|
|
extern "C" int __isinfl(long double);
|
2017-12-21 08:01:26 +01:00
|
|
|
extern "C" int isinfl(long double);
|
2017-10-19 22:56:28 +02:00
|
|
|
|
2017-11-02 06:17:26 +01:00
|
|
|
TEST(MATH_TEST, __isinf) {
|
|
|
|
ASSERT_FALSE(__isinf(123.0));
|
|
|
|
ASSERT_TRUE(__isinf(HUGE_VAL));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(__isinf(-HUGE_VAL));
|
2017-11-02 06:17:26 +01:00
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __isinff) {
|
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(__isinff(123.0f));
|
|
|
|
ASSERT_TRUE(__isinff(HUGE_VALF));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(__isinff(-HUGE_VALF));
|
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
|
|
|
}
|
|
|
|
|
2017-12-21 08:01:26 +01:00
|
|
|
TEST(MATH_TEST, isinff) {
|
|
|
|
ASSERT_FALSE(isinff(123.0f));
|
|
|
|
ASSERT_TRUE(isinff(HUGE_VALF));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(isinff(-HUGE_VALF));
|
2017-12-21 08:01:26 +01:00
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __isinfl) {
|
2014-04-01 17:41:12 +02: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));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(__isinfl(-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
|
|
|
}
|
|
|
|
|
2017-12-21 08:01:26 +01:00
|
|
|
TEST(MATH_TEST, isinfl) {
|
|
|
|
ASSERT_FALSE(isinfl(123.0L));
|
|
|
|
ASSERT_TRUE(isinfl(HUGE_VALL));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(isinfl(-HUGE_VALL));
|
2017-12-21 08:01:26 +01:00
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, isnan_function) {
|
Reimplement isinf/isnan/fpclassify.
Also move isinf and isnan into libc like everyone else.
Also move fpclassify to libc like the BSDs (but unlike glibc). We need
this to be able to upgrade our float/double/long double parsing to gdtoa.
Also add some missing aliases. We now have all of:
isnan, __isnan, isnanf, __isnanf, isnanl, __isnanl,
isinf, __isinf, isinff, __isinff, isinfl, __isinfl,
__fpclassify, __fpclassifyd, __fpclassifyf, __fpclassifyl.
Bug: 13469877
Change-Id: I407ffbac06c765a6c5fffda8106c37d7db04f27d
2014-04-12 02:02:20 +02:00
|
|
|
// The isnan macro deals with all three types; the isnan function is for doubles.
|
|
|
|
ASSERT_FALSE((isnan)(123.0));
|
|
|
|
ASSERT_TRUE((isnan)(nan("")));
|
|
|
|
}
|
|
|
|
|
2017-10-19 22:56:28 +02:00
|
|
|
// Historical BSD cruft that isn't exposed in <math.h> any more.
|
2017-11-02 06:17:26 +01:00
|
|
|
extern "C" int __isnan(double);
|
2017-10-19 22:56:28 +02:00
|
|
|
extern "C" int __isnanf(float);
|
2017-12-21 08:01:26 +01:00
|
|
|
extern "C" int isnanf(float);
|
2017-10-19 22:56:28 +02:00
|
|
|
extern "C" int __isnanl(long double);
|
2017-12-21 08:01:26 +01:00
|
|
|
extern "C" int isnanl(long double);
|
2017-10-19 22:56:28 +02:00
|
|
|
|
2017-11-02 06:17:26 +01:00
|
|
|
TEST(MATH_TEST, __isnan) {
|
|
|
|
ASSERT_FALSE(__isnan(123.0));
|
|
|
|
ASSERT_TRUE(__isnan(nan("")));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __isnanf) {
|
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(__isnanf(123.0f));
|
|
|
|
ASSERT_TRUE(__isnanf(nanf("")));
|
|
|
|
}
|
|
|
|
|
2017-12-21 08:01:26 +01:00
|
|
|
TEST(MATH_TEST, isnanf) {
|
|
|
|
ASSERT_FALSE(isnanf(123.0f));
|
|
|
|
ASSERT_TRUE(isnanf(nanf("")));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __isnanl) {
|
2014-04-01 17:41:12 +02: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("")));
|
|
|
|
}
|
|
|
|
|
2017-12-21 08:01:26 +01:00
|
|
|
TEST(MATH_TEST, isnanl) {
|
|
|
|
ASSERT_FALSE(isnanl(123.0L));
|
|
|
|
ASSERT_TRUE(isnanl(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
|
|
|
}
|
|
|
|
|
2017-10-19 22:56:28 +02:00
|
|
|
// Historical BSD cruft that isn't exposed in <math.h> any more.
|
|
|
|
extern "C" int __isnormal(double);
|
|
|
|
extern "C" int __isnormalf(float);
|
2017-12-21 08:01:26 +01:00
|
|
|
extern "C" int isnormalf(float);
|
2017-10-19 22:56:28 +02:00
|
|
|
extern "C" int __isnormall(long double);
|
2017-12-21 08:01:26 +01:00
|
|
|
extern "C" int isnormall(long double);
|
2017-10-19 22:56:28 +02:00
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __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__
|
2019-03-09 00:20:23 +01:00
|
|
|
GTEST_SKIP() << "glibc doesn't have __isnormal";
|
2013-12-21 03:43:21 +01:00
|
|
|
#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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __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__
|
2019-03-09 00:20:23 +01:00
|
|
|
GTEST_SKIP() << "glibc doesn't have __isnormalf";
|
2013-12-21 03:43:21 +01:00
|
|
|
#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
|
|
|
}
|
|
|
|
|
2017-12-21 08:01:26 +01:00
|
|
|
TEST(MATH_TEST, isnormalf) {
|
|
|
|
#if defined(__BIONIC__)
|
|
|
|
ASSERT_TRUE(isnormalf(123.0f));
|
|
|
|
ASSERT_FALSE(isnormalf(float_subnormal()));
|
|
|
|
#else // __BIONIC__
|
2019-03-09 00:20:23 +01:00
|
|
|
GTEST_SKIP() << "glibc doesn't have isnormalf";
|
2017-12-21 08:01:26 +01:00
|
|
|
#endif // __BIONIC__
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __isnormall) {
|
2013-12-21 03:43:21 +01:00
|
|
|
#if defined(__BIONIC__)
|
2014-04-01 17:41:12 +02:00
|
|
|
ASSERT_TRUE(__isnormall(123.0L));
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_FALSE(__isnormall(ldouble_subnormal()));
|
2013-12-21 03:43:21 +01:00
|
|
|
#else // __BIONIC__
|
2019-03-09 00:20:23 +01:00
|
|
|
GTEST_SKIP() << "glibc doesn't have __isnormall";
|
2013-12-21 03:43:21 +01:00
|
|
|
#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
|
|
|
}
|
|
|
|
|
2017-12-21 08:01:26 +01:00
|
|
|
TEST(MATH_TEST, isnormall) {
|
|
|
|
#if defined(__BIONIC__)
|
|
|
|
ASSERT_TRUE(isnormall(123.0L));
|
|
|
|
ASSERT_FALSE(isnormall(ldouble_subnormal()));
|
|
|
|
#else // __BIONIC__
|
2019-03-09 00:20:23 +01:00
|
|
|
GTEST_SKIP() << "glibc doesn't have isnormall";
|
2017-12-21 08:01:26 +01:00
|
|
|
#endif // __BIONIC__
|
|
|
|
}
|
|
|
|
|
2017-10-19 22:56:28 +02:00
|
|
|
// Historical BSD cruft that isn't exposed in <math.h> any more.
|
|
|
|
extern "C" int __signbit(double);
|
|
|
|
extern "C" int __signbitf(float);
|
|
|
|
extern "C" int __signbitl(long double);
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __signbit) {
|
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(0, __signbit(0.0));
|
|
|
|
ASSERT_EQ(0, __signbit(1.0));
|
|
|
|
ASSERT_NE(0, __signbit(-1.0));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __signbitf) {
|
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(0, __signbitf(0.0f));
|
|
|
|
ASSERT_EQ(0, __signbitf(1.0f));
|
|
|
|
ASSERT_NE(0, __signbitf(-1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, __signbitl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, acosf) {
|
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(static_cast<float>(M_PI)/2.0f, acosf(0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, acosl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, asinf) {
|
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.0f, asinf(0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, asinl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, atanf) {
|
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.0f, atanf(0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, atanl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, atan2f) {
|
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.0f, atan2f(0.0f, 0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, atan2l) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, cosf) {
|
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(1.0f, cosf(0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, cosl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sin) {
|
2014-04-01 17:41:12 +02:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, sin(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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sinf) {
|
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.0f, sinf(0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sinl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sincos) {
|
2016-09-26 18:35:04 +02:00
|
|
|
double s, c;
|
|
|
|
sincos(0.0, &s, &c);
|
|
|
|
ASSERT_DOUBLE_EQ(0.0, s);
|
|
|
|
ASSERT_DOUBLE_EQ(1.0, c);
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sincosf) {
|
2016-09-26 18:35:04 +02:00
|
|
|
float s, c;
|
|
|
|
sincosf(0.0f, &s, &c);
|
|
|
|
ASSERT_FLOAT_EQ(0.0f, s);
|
|
|
|
ASSERT_FLOAT_EQ(1.0f, c);
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sincosl) {
|
2016-09-26 18:35:04 +02:00
|
|
|
long double s, c;
|
|
|
|
sincosl(0.0L, &s, &c);
|
|
|
|
ASSERT_DOUBLE_EQ(0.0L, s);
|
|
|
|
ASSERT_DOUBLE_EQ(1.0L, c);
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, tanf) {
|
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.0f, tanf(0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, tanl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, acoshf) {
|
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.0f, acoshf(1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, acoshl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, asinhf) {
|
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.0f, asinhf(0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, asinhl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, atanhf) {
|
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.0f, atanhf(0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, atanhl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, coshf) {
|
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(1.0f, coshf(0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, coshl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sinhf) {
|
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.0f, sinhf(0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sinhl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, tanhf) {
|
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.0f, tanhf(0.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, tanhl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, logf) {
|
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(1.0f, logf(static_cast<float>(M_E)));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, logl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log2f) {
|
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(12.0f, log2f(4096.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log2l) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log10f) {
|
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(3.0f, log10f(1000.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log10l) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, cbrtf) {
|
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(3.0f, cbrtf(27.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, cbrtl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sqrtf) {
|
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(2.0f, sqrtf(4.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sqrtl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, expf) {
|
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(1.0f, expf(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(static_cast<float>(M_E), expf(1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, expl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, exp2f) {
|
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, exp2f(3.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, exp2l) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, expm1f) {
|
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(static_cast<float>(M_E) - 1.0f, expm1f(1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, expm1l) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, powl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ceilf) {
|
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(1.0f, ceilf(0.9f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ceill) {
|
2014-04-01 17:41:12 +02:00
|
|
|
ASSERT_DOUBLE_EQ(1.0L, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, floorf) {
|
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(1.0f, floorf(1.1f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, floorl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fabsf) {
|
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(1.0f, fabsf(-1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fabsl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ldexpf) {
|
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(16.0f, ldexpf(2.0f, 3.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ldexpl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmod) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(2.0, fmod(12.0, 10.0));
|
2018-07-23 23:25:36 +02:00
|
|
|
|
|
|
|
// If x is an infinity, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnan(fmod(HUGE_VAL, 10.0f)));
|
|
|
|
ASSERT_TRUE(isnan(fmod(-HUGE_VAL, 10.0f)));
|
|
|
|
|
|
|
|
// If x or y is a NaN, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnan(fmod(nan(""), 10.0)));
|
|
|
|
ASSERT_TRUE(isnan(fmod(12.0, nan(""))));
|
|
|
|
|
|
|
|
// If y is 0, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnan(fmod(3.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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmodf) {
|
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(2.0f, fmodf(12.0f, 10.0f));
|
2018-07-23 23:25:36 +02:00
|
|
|
|
|
|
|
// If x is an infinity, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanf(fmodf(HUGE_VALF, 10.0f)));
|
|
|
|
ASSERT_TRUE(isnanf(fmodf(-HUGE_VALF, 10.0f)));
|
|
|
|
|
|
|
|
// If x or y is a NaN, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanf(fmodf(nanf(""), 10.0f)));
|
|
|
|
ASSERT_TRUE(isnanf(fmodf(12.0f, nan(""))));
|
|
|
|
|
|
|
|
// If y is 0, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanf(fmodf(3.0f, 0.0f)));
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmodl) {
|
2014-04-01 17:41:12 +02:00
|
|
|
ASSERT_DOUBLE_EQ(2.0L, fmodl(12.0L, 10.0L));
|
2018-07-23 23:25:36 +02:00
|
|
|
|
|
|
|
// If x is an infinity, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanl(fmodl(HUGE_VALL, 10.0L)));
|
|
|
|
ASSERT_TRUE(isnanl(fmodl(-HUGE_VALL, 10.0L)));
|
|
|
|
|
|
|
|
// If x or y is a NaN, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanl(fmodl(nanl(""), 10.0L)));
|
|
|
|
ASSERT_TRUE(isnanl(fmodl(12.0L, nanl(""))));
|
|
|
|
|
|
|
|
// If y is 0, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanl(fmodl(3.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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, remainder) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(2.0, remainder(12.0, 10.0));
|
2018-07-23 23:25:36 +02:00
|
|
|
|
|
|
|
// If x or y is a NaN, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnan(remainder(nan(""), 10.0)));
|
|
|
|
ASSERT_TRUE(isnan(remainder(12.0, nan(""))));
|
|
|
|
|
|
|
|
// If x is an infinity, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnan(remainder(HUGE_VAL, 10.0)));
|
|
|
|
ASSERT_TRUE(isnan(remainder(-HUGE_VAL, 10.0)));
|
|
|
|
|
|
|
|
// If y is 0, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnan(remainder(12.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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, remainderf) {
|
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(2.0f, remainderf(12.0f, 10.0f));
|
2018-07-23 23:25:36 +02:00
|
|
|
|
|
|
|
// If x or y is a NaN, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanf(remainderf(nanf(""), 10.0f)));
|
|
|
|
ASSERT_TRUE(isnanf(remainderf(12.0f, nanf(""))));
|
|
|
|
|
|
|
|
// If x is an infinity, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanf(remainderf(HUGE_VALF, 10.0f)));
|
|
|
|
ASSERT_TRUE(isnanf(remainderf(-HUGE_VALF, 10.0f)));
|
|
|
|
|
|
|
|
// If y is 0, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanf(remainderf(12.0f, 0.0f)));
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, remainderl) {
|
2014-04-01 17:41:12 +02:00
|
|
|
ASSERT_DOUBLE_EQ(2.0L, remainderl(12.0L, 10.0L));
|
2018-07-23 23:25:36 +02:00
|
|
|
|
|
|
|
// If x or y is a NaN, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanl(remainderl(nanl(""), 10.0L)));
|
|
|
|
ASSERT_TRUE(isnanl(remainderl(12.0L, nanl(""))));
|
|
|
|
|
|
|
|
// If x is an infinity, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanl(remainderl(HUGE_VALL, 10.0L)));
|
|
|
|
ASSERT_TRUE(isnanl(remainderl(-HUGE_VALL, 10.0L)));
|
|
|
|
|
|
|
|
// If y is 0, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanl(remainderl(12.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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, dremf) {
|
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(2.0f, dremf(12.0f, 10.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmaxf) {
|
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(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));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmaxl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fminf) {
|
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(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));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fminl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmaf) {
|
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(10.0f, fmaf(2.0f, 3.0f, 4.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmal) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, hypot) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(5.0, hypot(3.0, 4.0));
|
2018-07-23 23:25:36 +02:00
|
|
|
|
|
|
|
// If x or y is an infinity, returns positive infinity.
|
|
|
|
ASSERT_EQ(HUGE_VAL, hypot(3.0, HUGE_VAL));
|
|
|
|
ASSERT_EQ(HUGE_VAL, hypot(3.0, -HUGE_VAL));
|
|
|
|
ASSERT_EQ(HUGE_VAL, hypot(HUGE_VAL, 4.0));
|
|
|
|
ASSERT_EQ(HUGE_VAL, hypot(-HUGE_VAL, 4.0));
|
|
|
|
|
|
|
|
// If x or y is a NaN, returns NaN.
|
|
|
|
ASSERT_TRUE(isnan(hypot(3.0, nan(""))));
|
|
|
|
ASSERT_TRUE(isnan(hypot(nan(""), 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, hypotf) {
|
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(5.0f, hypotf(3.0f, 4.0f));
|
2018-07-23 23:25:36 +02:00
|
|
|
|
|
|
|
// If x or y is an infinity, returns positive infinity.
|
|
|
|
ASSERT_EQ(HUGE_VALF, hypotf(3.0f, HUGE_VALF));
|
|
|
|
ASSERT_EQ(HUGE_VALF, hypotf(3.0f, -HUGE_VALF));
|
|
|
|
ASSERT_EQ(HUGE_VALF, hypotf(HUGE_VALF, 4.0f));
|
|
|
|
ASSERT_EQ(HUGE_VALF, hypotf(-HUGE_VALF, 4.0f));
|
|
|
|
|
|
|
|
// If x or y is a NaN, returns NaN.
|
|
|
|
ASSERT_TRUE(isnanf(hypotf(3.0f, nanf(""))));
|
|
|
|
ASSERT_TRUE(isnanf(hypotf(nanf(""), 4.0f)));
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, hypotl) {
|
2014-04-01 17:41:12 +02:00
|
|
|
ASSERT_DOUBLE_EQ(5.0L, hypotl(3.0L, 4.0L));
|
2018-07-23 23:25:36 +02:00
|
|
|
|
|
|
|
// If x or y is an infinity, returns positive infinity.
|
|
|
|
ASSERT_EQ(HUGE_VALL, hypotl(3.0L, HUGE_VALL));
|
|
|
|
ASSERT_EQ(HUGE_VALL, hypotl(3.0L, -HUGE_VALL));
|
|
|
|
ASSERT_EQ(HUGE_VALL, hypotl(HUGE_VALL, 4.0L));
|
|
|
|
ASSERT_EQ(HUGE_VALL, hypotl(-HUGE_VALL, 4.0L));
|
|
|
|
|
|
|
|
// If x or y is a NaN, returns NaN.
|
|
|
|
ASSERT_TRUE(isnanl(hypotl(3.0L, nanl(""))));
|
|
|
|
ASSERT_TRUE(isnanl(hypotl(nanl(""), 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, erff) {
|
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.84270078f, erff(1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, erfl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, erfcf) {
|
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.15729921f, erfcf(1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, erfcl) {
|
2018-12-12 00:16:24 +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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, lrint) {
|
2017-04-06 01:20:29 +02:00
|
|
|
auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
|
2014-09-04 21:47:07 +02:00
|
|
|
|
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); // lrint/lrintf/lrintl obey the rounding mode.
|
|
|
|
ASSERT_EQ(1235, lrint(1234.01));
|
|
|
|
ASSERT_EQ(1235, lrintf(1234.01f));
|
2014-04-01 17:41:12 +02: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-04-01 17:41:12 +02: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-04-01 17:41:12 +02: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-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, rint) {
|
2017-04-06 01:20:29 +02:00
|
|
|
auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
|
2014-09-04 21:47:07 +02:00
|
|
|
|
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); // 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-04-01 17:41:12 +02: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-04-01 17:41:12 +02: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-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, nearbyint) {
|
2017-04-06 01:20:29 +02:00
|
|
|
auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
|
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); // 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-04-01 17:41:12 +02: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-04-01 17:41:12 +02: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-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, lround) {
|
2017-04-06 01:20:29 +02:00
|
|
|
auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
|
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); // lround ignores the rounding mode.
|
|
|
|
ASSERT_EQ(1234, lround(1234.01));
|
|
|
|
ASSERT_EQ(1234, lroundf(1234.01f));
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, llround) {
|
2017-04-06 01:20:29 +02:00
|
|
|
auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
|
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); // llround ignores the rounding mode.
|
|
|
|
ASSERT_EQ(1234L, llround(1234.01));
|
|
|
|
ASSERT_EQ(1234L, llroundf(1234.01f));
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ilogb) {
|
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_ILOGB0, ilogb(0.0));
|
|
|
|
ASSERT_EQ(FP_ILOGBNAN, ilogb(nan("")));
|
|
|
|
ASSERT_EQ(INT_MAX, ilogb(HUGE_VAL));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_EQ(INT_MAX, ilogb(-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
|
|
|
ASSERT_EQ(0, ilogb(1.0));
|
|
|
|
ASSERT_EQ(3, ilogb(10.0));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ilogbf) {
|
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_ILOGB0, ilogbf(0.0f));
|
|
|
|
ASSERT_EQ(FP_ILOGBNAN, ilogbf(nanf("")));
|
|
|
|
ASSERT_EQ(INT_MAX, ilogbf(HUGE_VALF));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_EQ(INT_MAX, ilogbf(-HUGE_VALF));
|
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(0, ilogbf(1.0f));
|
|
|
|
ASSERT_EQ(3, ilogbf(10.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ilogbl) {
|
2014-04-01 17:41:12 +02: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));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_EQ(INT_MAX, ilogbl(-HUGE_VALL));
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, logb) {
|
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(-HUGE_VAL, logb(0.0));
|
|
|
|
ASSERT_TRUE(isnan(logb(nan(""))));
|
|
|
|
ASSERT_TRUE(isinf(logb(HUGE_VAL)));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(isinf(logb(-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
|
|
|
ASSERT_EQ(0.0, logb(1.0));
|
|
|
|
ASSERT_EQ(3.0, logb(10.0));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, logbf) {
|
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(-HUGE_VALF, logbf(0.0f));
|
|
|
|
ASSERT_TRUE(isnanf(logbf(nanf(""))));
|
2017-12-21 08:01:26 +01:00
|
|
|
ASSERT_TRUE(isinff(logbf(HUGE_VALF)));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(isinff(logbf(-HUGE_VALF)));
|
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(0.0f, logbf(1.0f));
|
|
|
|
ASSERT_EQ(3.0f, logbf(10.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, logbl) {
|
2014-04-01 17:41:12 +02: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)));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(isinf(logbl(-HUGE_VALL)));
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log1p) {
|
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(-HUGE_VAL, log1p(-1.0));
|
|
|
|
ASSERT_TRUE(isnan(log1p(nan(""))));
|
|
|
|
ASSERT_TRUE(isinf(log1p(HUGE_VAL)));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(isnan(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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log1pf) {
|
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(-HUGE_VALF, log1pf(-1.0f));
|
|
|
|
ASSERT_TRUE(isnanf(log1pf(nanf(""))));
|
2017-12-21 08:01:26 +01:00
|
|
|
ASSERT_TRUE(isinff(log1pf(HUGE_VALF)));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(isnanf(log1pf(-HUGE_VALF)));
|
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(1.0f, log1pf(static_cast<float>(M_E) - 1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log1pl) {
|
2014-04-01 17:41:12 +02:00
|
|
|
ASSERT_EQ(-HUGE_VALL, log1pl(-1.0L));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_TRUE(isnanl(log1pl(nanl(""))));
|
|
|
|
ASSERT_TRUE(isinfl(log1pl(HUGE_VALL)));
|
|
|
|
ASSERT_TRUE(isnanl(log1pl(-HUGE_VALL)));
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fdimf) {
|
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.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));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fdiml) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, round) {
|
2017-04-06 01:20:29 +02:00
|
|
|
auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
|
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); // 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));
|
2018-07-23 23:25:36 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, roundf) {
|
2017-04-06 01:20:29 +02:00
|
|
|
auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
|
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); // 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));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_FLOAT_EQ(-HUGE_VALF, roundf(-HUGE_VALF));
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, roundl) {
|
2017-04-06 01:20:29 +02:00
|
|
|
auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
|
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); // roundl ignores the rounding mode and always rounds away from zero.
|
2014-04-01 17:41:12 +02: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));
|
2018-07-23 23:25:36 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, trunc) {
|
2017-04-06 01:20:29 +02:00
|
|
|
auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
|
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); // 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));
|
2018-07-23 23:25:36 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, truncf) {
|
2017-04-06 01:20:29 +02:00
|
|
|
auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
|
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); // 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));
|
2018-07-23 23:25:36 +02:00
|
|
|
ASSERT_FLOAT_EQ(-HUGE_VALF, truncf(-HUGE_VALF));
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, truncl) {
|
2017-04-06 01:20:29 +02:00
|
|
|
auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
|
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); // truncl ignores the rounding mode and always rounds toward zero.
|
2014-04-01 17:41:12 +02: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));
|
2018-07-23 23:25:36 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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));
|
The nextafter functions use the wrong next representable value
From C99 standard: “The nextafter functions determine the next representable value, in the type of the function,
after x in the direction of y, where x and y are first converted to the type of the function”.
The next representable value of 0.0 in direction of -1.0 is -4.9406564584124654e-324, not 0.0.
Similar thing holds for nextafterf, nextafterl, nexttowardf, nexttoward, and nexttowardl.
The tests pass either way, since the error is within the tolerance, but how it is written is wrong.
Change-Id: I1338eeffe3de8031a48f46e1b07146bc07dc2f0a
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2014-09-18 18:50:00 +02:00
|
|
|
ASSERT_DOUBLE_EQ(-4.9406564584124654e-324, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, nextafterf) {
|
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.0f, nextafterf(0.0f, 0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(1.4012985e-45f, nextafterf(0.0f, 1.0f));
|
The nextafter functions use the wrong next representable value
From C99 standard: “The nextafter functions determine the next representable value, in the type of the function,
after x in the direction of y, where x and y are first converted to the type of the function”.
The next representable value of 0.0 in direction of -1.0 is -4.9406564584124654e-324, not 0.0.
Similar thing holds for nextafterf, nextafterl, nexttowardf, nexttoward, and nexttowardl.
The tests pass either way, since the error is within the tolerance, but how it is written is wrong.
Change-Id: I1338eeffe3de8031a48f46e1b07146bc07dc2f0a
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2014-09-18 18:50:00 +02:00
|
|
|
ASSERT_FLOAT_EQ(-1.4012985e-45f, nextafterf(0.0f, -1.0f));
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, nextafterl) {
|
2014-04-01 17:41:12 +02:00
|
|
|
ASSERT_DOUBLE_EQ(0.0L, nextafterl(0.0L, 0.0L));
|
2014-03-14 18:56:46 +01:00
|
|
|
// Use a runtime value to accomodate the case when
|
|
|
|
// sizeof(double) == sizeof(long double)
|
2014-04-01 17:41:12 +02:00
|
|
|
long double smallest_positive = ldexpl(1.0L, LDBL_MIN_EXP - LDBL_MANT_DIG);
|
|
|
|
ASSERT_DOUBLE_EQ(smallest_positive, nextafterl(0.0L, 1.0L));
|
The nextafter functions use the wrong next representable value
From C99 standard: “The nextafter functions determine the next representable value, in the type of the function,
after x in the direction of y, where x and y are first converted to the type of the function”.
The next representable value of 0.0 in direction of -1.0 is -4.9406564584124654e-324, not 0.0.
Similar thing holds for nextafterf, nextafterl, nexttowardf, nexttoward, and nexttowardl.
The tests pass either way, since the error is within the tolerance, but how it is written is wrong.
Change-Id: I1338eeffe3de8031a48f46e1b07146bc07dc2f0a
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2014-09-18 18:50:00 +02:00
|
|
|
ASSERT_DOUBLE_EQ(-smallest_positive, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, nexttoward) {
|
2014-04-17 19:17:32 +02:00
|
|
|
ASSERT_DOUBLE_EQ(0.0, nexttoward(0.0, 0.0L));
|
|
|
|
ASSERT_DOUBLE_EQ(4.9406564584124654e-324, nexttoward(0.0, 1.0L));
|
The nextafter functions use the wrong next representable value
From C99 standard: “The nextafter functions determine the next representable value, in the type of the function,
after x in the direction of y, where x and y are first converted to the type of the function”.
The next representable value of 0.0 in direction of -1.0 is -4.9406564584124654e-324, not 0.0.
Similar thing holds for nextafterf, nextafterl, nexttowardf, nexttoward, and nexttowardl.
The tests pass either way, since the error is within the tolerance, but how it is written is wrong.
Change-Id: I1338eeffe3de8031a48f46e1b07146bc07dc2f0a
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2014-09-18 18:50:00 +02:00
|
|
|
ASSERT_DOUBLE_EQ(-4.9406564584124654e-324, nexttoward(0.0, -1.0L));
|
2014-04-17 19:17:32 +02:00
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, nexttowardf) {
|
2014-04-17 19:17:32 +02:00
|
|
|
ASSERT_FLOAT_EQ(0.0f, nexttowardf(0.0f, 0.0L));
|
|
|
|
ASSERT_FLOAT_EQ(1.4012985e-45f, nexttowardf(0.0f, 1.0L));
|
The nextafter functions use the wrong next representable value
From C99 standard: “The nextafter functions determine the next representable value, in the type of the function,
after x in the direction of y, where x and y are first converted to the type of the function”.
The next representable value of 0.0 in direction of -1.0 is -4.9406564584124654e-324, not 0.0.
Similar thing holds for nextafterf, nextafterl, nexttowardf, nexttoward, and nexttowardl.
The tests pass either way, since the error is within the tolerance, but how it is written is wrong.
Change-Id: I1338eeffe3de8031a48f46e1b07146bc07dc2f0a
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2014-09-18 18:50:00 +02:00
|
|
|
ASSERT_FLOAT_EQ(-1.4012985e-45f, nexttowardf(0.0f, -1.0L));
|
2014-04-17 19:17:32 +02:00
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, nexttowardl) {
|
2014-04-17 19:17:32 +02:00
|
|
|
ASSERT_DOUBLE_EQ(0.0L, nexttowardl(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, nexttowardl(0.0L, 1.0L));
|
The nextafter functions use the wrong next representable value
From C99 standard: “The nextafter functions determine the next representable value, in the type of the function,
after x in the direction of y, where x and y are first converted to the type of the function”.
The next representable value of 0.0 in direction of -1.0 is -4.9406564584124654e-324, not 0.0.
Similar thing holds for nextafterf, nextafterl, nexttowardf, nexttoward, and nexttowardl.
The tests pass either way, since the error is within the tolerance, but how it is written is wrong.
Change-Id: I1338eeffe3de8031a48f46e1b07146bc07dc2f0a
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2014-09-18 18:50:00 +02:00
|
|
|
ASSERT_DOUBLE_EQ(-smallest_positive, nexttowardl(0.0L, -1.0L));
|
2014-04-17 19:17:32 +02:00
|
|
|
}
|
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
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, copysignf) {
|
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.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));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, copysignl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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));
|
The nextafter functions use the wrong next representable value
From C99 standard: “The nextafter functions determine the next representable value, in the type of the function,
after x in the direction of y, where x and y are first converted to the type of the function”.
The next representable value of 0.0 in direction of -1.0 is -4.9406564584124654e-324, not 0.0.
Similar thing holds for nextafterf, nextafterl, nexttowardf, nexttoward, and nexttowardl.
The tests pass either way, since the error is within the tolerance, but how it is written is wrong.
Change-Id: I1338eeffe3de8031a48f46e1b07146bc07dc2f0a
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2014-09-18 18:50:00 +02:00
|
|
|
ASSERT_DOUBLE_EQ(1.53125, significand(12.25));
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, significandf) {
|
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.0f, significandf(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(1.2f, significandf(1.2f));
|
The nextafter functions use the wrong next representable value
From C99 standard: “The nextafter functions determine the next representable value, in the type of the function,
after x in the direction of y, where x and y are first converted to the type of the function”.
The next representable value of 0.0 in direction of -1.0 is -4.9406564584124654e-324, not 0.0.
Similar thing holds for nextafterf, nextafterl, nexttowardf, nexttoward, and nexttowardl.
The tests pass either way, since the error is within the tolerance, but how it is written is wrong.
Change-Id: I1338eeffe3de8031a48f46e1b07146bc07dc2f0a
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2014-09-18 18:50:00 +02:00
|
|
|
ASSERT_FLOAT_EQ(1.53125f, significandf(12.25f));
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, significandl) {
|
2014-04-01 17:41:12 +02:00
|
|
|
ASSERT_DOUBLE_EQ(0.0L, significandl(0.0L));
|
|
|
|
ASSERT_DOUBLE_EQ(1.2L, significandl(1.2L));
|
The nextafter functions use the wrong next representable value
From C99 standard: “The nextafter functions determine the next representable value, in the type of the function,
after x in the direction of y, where x and y are first converted to the type of the function”.
The next representable value of 0.0 in direction of -1.0 is -4.9406564584124654e-324, not 0.0.
Similar thing holds for nextafterf, nextafterl, nexttowardf, nexttoward, and nexttowardl.
The tests pass either way, since the error is within the tolerance, but how it is written is wrong.
Change-Id: I1338eeffe3de8031a48f46e1b07146bc07dc2f0a
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2014-09-18 18:50:00 +02:00
|
|
|
ASSERT_DOUBLE_EQ(1.53125L, significandl(12.25L));
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, scalbf) {
|
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(12.0f, scalbf(3.0f, 2.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, scalblnf) {
|
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(12.0f, scalblnf(3.0f, 2L));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, scalblnl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, scalbnf) {
|
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(12.0f, scalbnf(3.0f, 2));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, scalbnl) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, gammaf) {
|
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(logf(24.0f), gammaf(5.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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__
|
2019-03-09 00:20:23 +01:00
|
|
|
GTEST_SKIP() << "glibc doesn't have gamma_r";
|
2013-12-21 03:43:21 +01:00
|
|
|
#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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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__
|
2019-03-09 00:20:23 +01:00
|
|
|
GTEST_SKIP() << "glibc doesn't have gammaf_r";
|
2013-12-21 03:43:21 +01:00
|
|
|
#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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, lgammaf) {
|
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(logf(24.0f), lgammaf(5.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, lgammal) {
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, lgamma_r) {
|
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), 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);
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, lgamma_r_17471883) {
|
2014-09-18 20:23:58 +02:00
|
|
|
int sign;
|
|
|
|
|
|
|
|
sign = 0;
|
|
|
|
ASSERT_DOUBLE_EQ(HUGE_VAL, lgamma_r(0.0, &sign));
|
|
|
|
ASSERT_EQ(1, sign);
|
|
|
|
sign = 0;
|
|
|
|
ASSERT_DOUBLE_EQ(HUGE_VAL, lgamma_r(-0.0, &sign));
|
|
|
|
ASSERT_EQ(-1, sign);
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, lgammaf_r) {
|
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), lgammaf_r(5.0f, &sign));
|
|
|
|
ASSERT_EQ(1, sign);
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, lgammaf_r_17471883) {
|
2014-09-18 20:23:58 +02:00
|
|
|
int sign;
|
|
|
|
|
|
|
|
sign = 0;
|
|
|
|
ASSERT_FLOAT_EQ(HUGE_VALF, lgammaf_r(0.0f, &sign));
|
|
|
|
ASSERT_EQ(1, sign);
|
|
|
|
sign = 0;
|
|
|
|
ASSERT_FLOAT_EQ(HUGE_VALF, lgammaf_r(-0.0f, &sign));
|
|
|
|
ASSERT_EQ(-1, sign);
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, lgammal_r) {
|
2014-09-18 20:23:58 +02:00
|
|
|
int sign;
|
|
|
|
ASSERT_DOUBLE_EQ(log(24.0L), lgamma_r(5.0L, &sign));
|
|
|
|
ASSERT_EQ(1, sign);
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, lgammal_r_17471883) {
|
2014-09-18 20:23:58 +02:00
|
|
|
int sign;
|
|
|
|
|
|
|
|
sign = 0;
|
|
|
|
ASSERT_DOUBLE_EQ(HUGE_VAL, lgammal_r(0.0L, &sign));
|
|
|
|
ASSERT_EQ(1, sign);
|
|
|
|
sign = 0;
|
|
|
|
ASSERT_DOUBLE_EQ(HUGE_VAL, lgammal_r(-0.0L, &sign));
|
|
|
|
ASSERT_EQ(-1, sign);
|
|
|
|
}
|
|
|
|
|
2021-04-09 05:59:07 +02:00
|
|
|
TEST(MATH_TEST, tgamma_NaN) {
|
|
|
|
ASSERT_TRUE(isnan(tgamma(nan(""))));
|
|
|
|
ASSERT_TRUE(isnanf(tgammaf(nanf(""))));
|
|
|
|
ASSERT_TRUE(isnanl(tgammal(nanl(""))));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(MATH_TEST, tgamma_inf) {
|
|
|
|
ASSERT_TRUE(isinf(tgamma(HUGE_VAL)));
|
|
|
|
ASSERT_TRUE(isinff(tgammaf(HUGE_VALF)));
|
|
|
|
ASSERT_TRUE(isinfl(tgammal(HUGE_VALL)));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(MATH_TEST, tgamma_negative) {
|
|
|
|
ASSERT_TRUE(isnan(tgamma(-1.0)));
|
|
|
|
ASSERT_TRUE(isnanf(tgammaf(-1.0f)));
|
|
|
|
ASSERT_TRUE(isnanl(tgammal(-1.0L)));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, tgamma) {
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(24.0, tgamma(5.0));
|
2021-04-09 05:59:07 +02:00
|
|
|
ASSERT_DOUBLE_EQ(120.0, tgamma(6.0));
|
|
|
|
ASSERT_TRUE(isinf(tgamma(172.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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, tgammaf) {
|
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(24.0f, tgammaf(5.0f));
|
2021-04-09 05:59:07 +02:00
|
|
|
ASSERT_FLOAT_EQ(120.0f, tgammaf(6.0f));
|
|
|
|
ASSERT_TRUE(isinff(tgammaf(172.0f)));
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, tgammal) {
|
2014-04-01 17:41:12 +02:00
|
|
|
ASSERT_DOUBLE_EQ(24.0L, tgammal(5.0L));
|
2021-04-09 05:59:07 +02:00
|
|
|
ASSERT_DOUBLE_EQ(120.0L, tgammal(6.0L));
|
|
|
|
ASSERT_TRUE(isinf(tgammal(172.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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, j0f) {
|
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(1.0f, j0f(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(0.76519769f, j0f(1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, j1f) {
|
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.0f, j1f(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(0.44005057f, j1f(1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, jnf) {
|
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.0f, jnf(4, 0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(0.0024766389f, jnf(4, 1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, y0f) {
|
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(-HUGE_VALF, y0f(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(0.088256963f, y0f(1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, y1f) {
|
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(-HUGE_VALF, y1f(0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(-0.78121281f, y1f(1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ynf) {
|
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(-HUGE_VALF, ynf(4, 0.0f));
|
|
|
|
ASSERT_FLOAT_EQ(-33.278423f, ynf(4, 1.0f));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, frexp) {
|
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 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, frexpf) {
|
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 exp;
|
|
|
|
float fr = frexpf(1024.0f, &exp);
|
|
|
|
ASSERT_FLOAT_EQ(1024.0f, scalbnf(fr, exp));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, frexpl) {
|
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 exp;
|
2014-04-01 17:41:12 +02: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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, modf) {
|
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
|
|
|
double di;
|
2014-04-01 17:45:53 +02:00
|
|
|
double df = modf(123.75, &di);
|
2014-03-14 18:56:46 +01:00
|
|
|
ASSERT_DOUBLE_EQ(123.0, di);
|
2014-04-01 17:45:53 +02:00
|
|
|
ASSERT_DOUBLE_EQ(0.75, 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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, modff) {
|
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
|
|
|
float fi;
|
2014-04-01 17:45:53 +02:00
|
|
|
float ff = modff(123.75f, &fi);
|
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(123.0f, fi);
|
2014-04-01 17:45:53 +02:00
|
|
|
ASSERT_FLOAT_EQ(0.75f, ff);
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, modfl) {
|
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
|
|
|
long double ldi;
|
2014-04-01 17:45:53 +02:00
|
|
|
long double ldf = modfl(123.75L, &ldi);
|
|
|
|
ASSERT_DOUBLE_EQ(123.0L, ldi);
|
|
|
|
ASSERT_DOUBLE_EQ(0.75L, ldf);
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, remquo) {
|
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 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);
|
2018-07-23 23:25:36 +02:00
|
|
|
|
|
|
|
// If x or y is a NaN, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnan(remquo(nan(""), 10.0, &q)));
|
|
|
|
ASSERT_TRUE(isnan(remquo(12.0, nan(""), &q)));
|
|
|
|
|
|
|
|
// If x is an infinity, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnan(remquo(HUGE_VAL, 10.0, &q)));
|
|
|
|
ASSERT_TRUE(isnan(remquo(-HUGE_VAL, 10.0, &q)));
|
|
|
|
|
|
|
|
// If y is 0, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnan(remquo(12.0, 0.0, &q)));
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, remquof) {
|
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 q;
|
|
|
|
float f = remquof(13.0f, 4.0f, &q);
|
|
|
|
ASSERT_EQ(3, q);
|
|
|
|
ASSERT_FLOAT_EQ(1.0, f);
|
2018-07-23 23:25:36 +02:00
|
|
|
|
|
|
|
// If x or y is a NaN, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanf(remquof(nanf(""), 10.0f, &q)));
|
|
|
|
ASSERT_TRUE(isnanf(remquof(12.0f, nanf(""), &q)));
|
|
|
|
|
|
|
|
// If x is an infinity, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanf(remquof(HUGE_VALF, 10.0f, &q)));
|
|
|
|
ASSERT_TRUE(isnanf(remquof(-HUGE_VALF, 10.0f, &q)));
|
|
|
|
|
|
|
|
// If y is 0, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanf(remquof(12.0f, 0.0f, &q)));
|
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
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, remquol) {
|
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 q;
|
2014-04-01 17:41:12 +02:00
|
|
|
long double ld = remquol(13.0L, 4.0L, &q);
|
|
|
|
ASSERT_DOUBLE_EQ(3L, q);
|
|
|
|
ASSERT_DOUBLE_EQ(1.0L, ld);
|
2018-07-23 23:25:36 +02:00
|
|
|
|
|
|
|
// If x or y is a NaN, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanl(remquol(nanl(""), 10.0L, &q)));
|
|
|
|
ASSERT_TRUE(isnanl(remquol(12.0L, nanl(""), &q)));
|
|
|
|
|
|
|
|
// If x is an infinity, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanl(remquol(HUGE_VALL, 10.0L, &q)));
|
|
|
|
ASSERT_TRUE(isnanl(remquol(-HUGE_VALL, 10.0L, &q)));
|
|
|
|
|
|
|
|
// If y is 0, NaN is returned.
|
|
|
|
ASSERT_TRUE(isnanl(remquol(12.0L, 0.0L, &q)));
|
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
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, frexpf_public_bug_6697) {
|
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 exp;
|
|
|
|
float fr = frexpf(14.1f, &exp);
|
|
|
|
ASSERT_FLOAT_EQ(14.1f, scalbnf(fr, exp));
|
|
|
|
}
|
2014-06-07 06:43:33 +02:00
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, exp2_STRICT_ALIGN_OpenBSD_bug) {
|
2014-06-07 06:43:33 +02:00
|
|
|
// OpenBSD/x86's libm had a bug here, but it was already fixed in FreeBSD:
|
|
|
|
// http://svnweb.FreeBSD.org/base/head/lib/msun/src/math_private.h?revision=240827&view=markup
|
|
|
|
ASSERT_DOUBLE_EQ(5.0, exp2(log2(5)));
|
|
|
|
ASSERT_FLOAT_EQ(5.0f, exp2f(log2f(5)));
|
|
|
|
ASSERT_DOUBLE_EQ(5.0L, exp2l(log2l(5)));
|
|
|
|
}
|
|
|
|
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, nextafterl_OpenBSD_bug) {
|
2014-06-07 06:43:33 +02:00
|
|
|
// OpenBSD/x86's libm had a bug here.
|
|
|
|
ASSERT_TRUE(nextafter(1.0, 0.0) - 1.0 < 0.0);
|
|
|
|
ASSERT_TRUE(nextafterf(1.0f, 0.0f) - 1.0f < 0.0f);
|
|
|
|
ASSERT_TRUE(nextafterl(1.0L, 0.0L) - 1.0L < 0.0L);
|
|
|
|
}
|
2014-11-04 02:03:20 +01:00
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/acos_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, acos_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_acos_intel_data, acos);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/acosf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, acosf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_acosf_intel_data, acosf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/acosh_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, acosh_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_acosh_intel_data, acosh);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/acoshf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, acoshf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_acoshf_intel_data, acoshf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/asin_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, asin_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_asin_intel_data, asin);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/asinf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, asinf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_asinf_intel_data, asinf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/asinh_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, asinh_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_asinh_intel_data, asinh);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/asinhf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, asinhf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_asinhf_intel_data, asinhf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/atan2_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, atan2_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_atan2_intel_data, atan2);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/atan2f_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, atan2f_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_atan2f_intel_data, atan2f);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/atan_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, atan_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_atan_intel_data, atan);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/atanf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, atanf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_atanf_intel_data, atanf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/atanh_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, atanh_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_atanh_intel_data, atanh);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/atanhf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, atanhf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_atanhf_intel_data, atanhf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/cbrt_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, cbrt_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_cbrt_intel_data, cbrt);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/cbrtf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, cbrtf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_cbrtf_intel_data, cbrtf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/ceil_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ceil_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_ceil_intel_data, ceil);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/ceilf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ceilf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_ceilf_intel_data, ceilf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/copysign_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, copysign_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_copysign_intel_data, copysign);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/copysignf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, copysignf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_copysignf_intel_data, copysignf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/cos_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, cos_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_cos_intel_data, cos);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/cosf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, cosf_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_cosf_intel_data, cosf);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/cosh_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, cosh_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_cosh_intel_data, cosh);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/coshf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, coshf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_coshf_intel_data, coshf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/exp_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, exp_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_exp_intel_data, exp);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/expf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, expf_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_expf_intel_data, expf);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/exp2_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, exp2_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_exp2_intel_data, exp2);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/exp2f_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, exp2f_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_exp2f_intel_data, exp2f);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/expm1_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, expm1_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_expm1_intel_data, expm1);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/expm1f_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, expm1f_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_expm1f_intel_data, expm1f);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/fabs_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fabs_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_fabs_intel_data, fabs);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/fabsf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fabsf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_fabsf_intel_data, fabsf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/fdim_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fdim_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_fdim_intel_data, fdim);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/fdimf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fdimf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_fdimf_intel_data, fdimf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/floor_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, floor_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_floor_intel_data, floor);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/floorf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, floorf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_floorf_intel_data, floorf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/fma_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fma_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_fma_intel_data, fma);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/fmaf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmaf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_fmaf_intel_data, fmaf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/fmax_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmax_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_fmax_intel_data, fmax);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/fmaxf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmaxf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_fmaxf_intel_data, fmaxf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/fmin_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmin_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_fmin_intel_data, fmin);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/fminf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fminf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_fminf_intel_data, fminf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/fmod_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmod_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_fmod_intel_data, fmod);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/fmodf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, fmodf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_fmodf_intel_data, fmodf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/frexp_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, frexp_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_frexp_intel_data, frexp);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/frexpf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, frexpf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_frexpf_intel_data, frexpf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/hypot_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, hypot_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_hypot_intel_data, hypot);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/hypotf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, hypotf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_hypotf_intel_data, hypotf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/ilogb_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ilogb_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_ilogb_intel_data, ilogb);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/ilogbf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ilogbf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_ilogbf_intel_data, ilogbf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/ldexp_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ldexp_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_ldexp_intel_data, ldexp);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/ldexpf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, ldexpf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_ldexpf_intel_data, ldexpf);
|
|
|
|
}
|
|
|
|
|
2015-06-12 18:15:02 +02:00
|
|
|
#include "math_data/llrint_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, llrint_intel) {
|
2015-06-12 18:15:02 +02:00
|
|
|
DoMathDataTest<1>(g_llrint_intel_data, llrint);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/llrintf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, llrintf_intel) {
|
2015-06-12 18:15:02 +02:00
|
|
|
DoMathDataTest<1>(g_llrintf_intel_data, llrintf);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/log_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_log_intel_data, log);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/logf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, logf_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_logf_intel_data, logf);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/log10_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log10_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_log10_intel_data, log10);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/log10f_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log10f_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_log10f_intel_data, log10f);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/log1p_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log1p_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_log1p_intel_data, log1p);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/log1pf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log1pf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_log1pf_intel_data, log1pf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/log2_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log2_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_log2_intel_data, log2);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/log2f_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, log2f_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_log2f_intel_data, log2f);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/logb_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, logb_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_logb_intel_data, logb);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/logbf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, logbf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_logbf_intel_data, logbf);
|
|
|
|
}
|
|
|
|
|
2015-06-12 18:15:02 +02:00
|
|
|
#include "math_data/lrint_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, lrint_intel) {
|
2015-06-12 18:15:02 +02:00
|
|
|
DoMathDataTest<1>(g_lrint_intel_data, lrint);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/lrintf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, lrintf_intel) {
|
2015-06-12 18:15:02 +02:00
|
|
|
DoMathDataTest<1>(g_lrintf_intel_data, lrintf);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/modf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, modf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_modf_intel_data, modf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/modff_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, modff_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_modff_intel_data, modff);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/nearbyint_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, nearbyint_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_nearbyint_intel_data, nearbyint);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/nearbyintf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, nearbyintf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_nearbyintf_intel_data, nearbyintf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/nextafter_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, nextafter_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_nextafter_intel_data, nextafter);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/nextafterf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, nextafterf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_nextafterf_intel_data, nextafterf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/pow_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, pow_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_pow_intel_data, pow);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/powf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, powf_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_powf_intel_data, powf);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/remainder_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, remainder_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_remainder_intel_data, remainder);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/remainderf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, remainderf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_remainderf_intel_data, remainderf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/remquo_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, remquo_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_remquo_intel_data, remquo);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/remquof_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, remquof_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_remquof_intel_data, remquof);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/rint_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, rint_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_rint_intel_data, rint);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/rintf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, rintf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_rintf_intel_data, rintf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/round_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, round_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_round_intel_data, round);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/roundf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, roundf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_roundf_intel_data, roundf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/scalb_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, scalb_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_scalb_intel_data, scalb);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/scalbf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, scalbf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_scalbf_intel_data, scalbf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/scalbn_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, scalbn_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_scalbn_intel_data, scalbn);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/scalbnf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, scalbnf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_scalbnf_intel_data, scalbnf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/significand_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, significand_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_significand_intel_data, significand);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/significandf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, significandf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_significandf_intel_data, significandf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/sin_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sin_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_sin_intel_data, sin);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/sinf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sinf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_sinf_intel_data, sinf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/sinh_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sinh_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_sinh_intel_data, sinh);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/sinhf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sinhf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_sinhf_intel_data, sinhf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/sincos_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sincos_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_sincos_intel_data, sincos);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/sincosf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sincosf_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_sincosf_intel_data, sincosf);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/sqrt_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sqrt_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_sqrt_intel_data, sqrt);
|
2014-11-04 02:03:20 +01:00
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/sqrtf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, sqrtf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_sqrtf_intel_data, sqrtf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/tan_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, tan_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_tan_intel_data, tan);
|
|
|
|
}
|
|
|
|
|
2014-09-02 15:39:14 +02:00
|
|
|
#include "math_data/tanf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, tanf_intel) {
|
2014-11-04 02:03:20 +01:00
|
|
|
DoMathDataTest<1>(g_tanf_intel_data, tanf);
|
|
|
|
}
|
2014-09-02 15:39:14 +02:00
|
|
|
|
|
|
|
#include "math_data/tanh_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, tanh_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_tanh_intel_data, tanh);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/tanhf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, tanhf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<2>(g_tanhf_intel_data, tanhf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/trunc_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, trunc_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_trunc_intel_data, trunc);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "math_data/truncf_intel_data.h"
|
2017-09-15 00:30:08 +02:00
|
|
|
TEST(MATH_TEST, truncf_intel) {
|
2014-09-02 15:39:14 +02:00
|
|
|
DoMathDataTest<1>(g_truncf_intel_data, truncf);
|
|
|
|
}
|