1a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes/* 2a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * Copyright (C) 2013 The Android Open Source Project 3a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * 4a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * Licensed under the Apache License, Version 2.0 (the "License"); 5a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * you may not use this file except in compliance with the License. 6a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * You may obtain a copy of the License at 7a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * 8a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 9a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * 10a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * Unless required by applicable law or agreed to in writing, software 11a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 12a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * See the License for the specific language governing permissions and 14a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes * limitations under the License. 15a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes */ 16a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 17a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#define _DECLARE_C99_LDBL_MATH 1 18a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 19a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#include <gtest/gtest.h> 20a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 21a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#include <fenv.h> 22a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#include <limits.h> 23a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#include <math.h> 24a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#include <stdint.h> 25a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 26a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughesfloat float_subnormal() { 27a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes union { 28a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes float f; 29a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes uint32_t i; 30a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes } u; 31a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes u.i = 0x007fffff; 32a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes return u.f; 33a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 34a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 35a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughesdouble double_subnormal() { 36a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes union { 37a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes double d; 38a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes uint64_t i; 39a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes } u; 405227663d2ffd70dc32f03a7a5b103ef0d3fc0584Elliott Hughes u.i = 0x000fffffffffffffLL; 41a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes return u.d; 42a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 43a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 44a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fpclassify) { 45a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_INFINITE, fpclassify(INFINITY)); 46a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_INFINITE, fpclassify(HUGE_VALF)); 47a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_INFINITE, fpclassify(HUGE_VAL)); 48a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 49a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_NAN, fpclassify(nanf(""))); 50a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_NAN, fpclassify(nan(""))); 51a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 52a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_NORMAL, fpclassify(1.0f)); 53a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_NORMAL, fpclassify(1.0)); 54a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 55a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_SUBNORMAL, fpclassify(float_subnormal())); 56a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_SUBNORMAL, fpclassify(double_subnormal())); 57a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 58a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_ZERO, fpclassify(0.0f)); 59a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_ZERO, fpclassify(0.0)); 60a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 61a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 62a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes/* TODO: stlport breaks the isfinite macro 63a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, isfinite) { 64a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isfinite(123.0f)); 65a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isfinite(123.0)); 66a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(isfinite(HUGE_VALF)); 67a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(isfinite(HUGE_VAL)); 68a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 69a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes*/ 70a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 71a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, isinf) { 72a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(isinf(123.0f)); 73a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(isinf(123.0)); 74a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isinf(HUGE_VALF)); 75a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isinf(HUGE_VAL)); 76a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 77a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 78a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, isnan) { 79a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(isnan(123.0f)); 80a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(isnan(123.0)); 81a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnan(nanf(""))); 82a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnan(nan(""))); 83a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 84a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 85a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, isnormal) { 86a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnormal(123.0f)); 87a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnormal(123.0)); 88a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(isnormal(float_subnormal())); 89a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(isnormal(double_subnormal())); 90a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 91a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 92a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes// TODO: isgreater, isgreaterequals, isless, islessequal, islessgreater, isunordered 93a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 94a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes/* TODO: stlport breaks the signbit macro 95a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, signbit) { 96a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, signbit(0.0f)); 97a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, signbit(0.0)); 98a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 99a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, signbit(1.0f)); 100a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, signbit(1.0)); 101a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 102a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_NE(0, signbit(-1.0f)); 103a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_NE(0, signbit(-1.0)); 104a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 105a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes*/ 106a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 107a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#if defined(__BIONIC__) 108a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __fpclassifyd) { 109a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_INFINITE, __fpclassifyd(HUGE_VAL)); 110a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_NAN, __fpclassifyd(nan(""))); 111a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_NORMAL, __fpclassifyd(1.0)); 112a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_SUBNORMAL, __fpclassifyd(double_subnormal())); 113a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_ZERO, __fpclassifyd(0.0)); 114a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 115a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#endif 116a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 117a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#if defined(__BIONIC__) 118a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __fpclassifyf) { 119a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_INFINITE, __fpclassifyf(HUGE_VALF)); 120a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_NAN, __fpclassifyf(nanf(""))); 121a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_NORMAL, __fpclassifyf(1.0f)); 122a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_SUBNORMAL, __fpclassifyf(float_subnormal())); 123a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_ZERO, __fpclassifyf(0.0f)); 124a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 125a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#endif 126a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 127a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#if defined(__BIONIC__) 128a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __fpclassifyl) { 129a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes EXPECT_EQ(FP_INFINITE, __fpclassifyl(HUGE_VALL)); 130a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes EXPECT_EQ(FP_NAN, __fpclassifyl(nanl(""))); 131a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes EXPECT_EQ(FP_NORMAL, __fpclassifyl(1.0)); 132a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes EXPECT_EQ(FP_SUBNORMAL, __fpclassifyl(double_subnormal())); 133a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes EXPECT_EQ(FP_ZERO, __fpclassifyl(0.0)); 134a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 135a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#endif 136a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 137a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, finitef) { 138a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(finitef(123.0f)); 139a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(finitef(HUGE_VALF)); 140a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 141a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 142a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#if defined(__BIONIC__) 143a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __isfinite) { 144a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(__isfinite(123.0)); 145a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(__isfinite(HUGE_VAL)); 146a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 147a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#endif 148a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 149a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#if defined(__BIONIC__) 150a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __isfinitef) { 151a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(__isfinitef(123.0f)); 152a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(__isfinitef(HUGE_VALF)); 153a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 154a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#endif 155a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 156a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#if defined(__BIONIC__) 157a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __isfinitel) { 158a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(__isfinitel(123.0f)); 159a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(__isfinitel(HUGE_VALL)); 160a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 161a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#endif 162a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 163a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, finite) { 164a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(finite(123.0)); 165a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(finite(HUGE_VAL)); 166a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 167a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 168a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __isinff) { 169a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(__isinff(123.0f)); 170a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(__isinff(HUGE_VALF)); 171a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 172a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 173a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __isinfl) { 174a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(__isinfl(123.0)); 175a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(__isinfl(HUGE_VALL)); 176a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 177a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 178a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __isnanf) { 179a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(__isnanf(123.0f)); 180a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(__isnanf(nanf(""))); 181a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 182a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 183a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __isnanl) { 184a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(__isnanl(123.0)); 185a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(__isnanl(nanl(""))); 186a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 187a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 188a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, isnanf) { 189a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(isnanf(123.0f)); 190a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnanf(nanf(""))); 191a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 192a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 193a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#if defined(__BIONIC__) 194a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __isnormal) { 195a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(__isnormal(123.0)); 196a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(__isnormal(double_subnormal())); 197a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 198a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#endif 199a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 200a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#if defined(__BIONIC__) 201a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __isnormalf) { 202a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(__isnormalf(123.0f)); 203a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(__isnormalf(float_subnormal())); 204a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 205a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#endif 206a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 207a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#if defined(__BIONIC__) 208a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __isnormall) { 209a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(__isnormall(123.0)); 210a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FALSE(__isnormall(double_subnormal())); 211a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 212a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#endif 213a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 214a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __signbit) { 215a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, __signbit(0.0)); 216a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, __signbit(1.0)); 217a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_NE(0, __signbit(-1.0)); 218a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 219a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 220a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __signbitf) { 221a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, __signbitf(0.0f)); 222a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, __signbitf(1.0f)); 223a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_NE(0, __signbitf(-1.0f)); 224a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 225a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 226a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, __signbitl) { 227a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, __signbitl(0.0)); 228a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, __signbitl(1.0)); 229a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_NE(0, __signbitl(-1.0)); 230a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 231a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 232a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, acos) { 233a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(M_PI/2.0, acos(0.0)); 234a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 235a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 236a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, acosf) { 237a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(static_cast<float>(M_PI)/2.0f, acosf(0.0f)); 238a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 239a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 240a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, acosl) { 241a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(M_PI/2.0, acosl(0.0)); 242a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 243a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 244a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, asin) { 245a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, asin(0.0)); 246a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 247a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 248a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, asinf) { 249a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, asinf(0.0f)); 250a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 251a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 252a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, asinl) { 253a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, asinl(0.0)); 254a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 255a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 256a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, atan) { 257a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, atan(0.0)); 258a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 259a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 260a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, atanf) { 261a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, atanf(0.0f)); 262a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 263a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 264a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, atanl) { 265a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, atanl(0.0)); 266a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 267a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 268a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, atan2) { 269a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, atan2(0.0, 0.0)); 270a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 271a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 272a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, atan2f) { 273a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, atan2f(0.0f, 0.0f)); 274a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 275a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 276a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, atan2l) { 277a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, atan2l(0.0, 0.0)); 278a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 279a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 280a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, cos) { 281a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, cos(0.0)); 282a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 283a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 284a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, cosf) { 285a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0f, cosf(0.0f)); 286a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 287a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 288a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, cosl) { 289a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, cosl(0.0)); 290a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 291a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 292a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, sin) { 293a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, sin(0.0)); 294a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 295a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 296a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, sinf) { 297a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, sinf(0.0f)); 298a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 299a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 300a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, sinl) { 301a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, sinl(0.0)); 302a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 303a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 304a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, tan) { 305a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, tan(0.0)); 306a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 307a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 308a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, tanf) { 309a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, tanf(0.0f)); 310a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 311a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 312a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, tanl) { 313a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, tanl(0.0)); 314a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 315a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 316a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, acosh) { 317a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, acosh(1.0)); 318a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 319a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 320a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, acoshf) { 321a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, acoshf(1.0f)); 322a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 323a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 324a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, acoshl) { 325a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, acoshl(1.0)); 326a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 327a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 328a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, asinh) { 329a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, asinh(0.0)); 330a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 331a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 332a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, asinhf) { 333a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, asinhf(0.0f)); 334a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 335a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 336a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, asinhl) { 337a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, asinhl(0.0)); 338a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 339a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 340a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, atanh) { 341a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, atanh(0.0)); 342a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 343a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 344a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, atanhf) { 345a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, atanhf(0.0f)); 346a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 347a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 348a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, atanhl) { 349a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, atanhl(0.0)); 350a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 351a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 352a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, cosh) { 353a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, cosh(0.0)); 354a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 355a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 356a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, coshf) { 357a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0f, coshf(0.0f)); 358a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 359a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 360a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, coshl) { 361a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, coshl(0.0)); 362a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 363a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 364a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, sinh) { 365a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, sinh(0.0)); 366a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 367a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 368a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, sinhf) { 369a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, sinhf(0.0f)); 370a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 371a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 372a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, sinhl) { 373a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, sinhl(0.0)); 374a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 375a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 376a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, tanh) { 377a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, tanh(0.0)); 378a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 379a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 380a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, tanhf) { 381a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, tanhf(0.0f)); 382a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 383a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 384a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, tanhl) { 385a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, tanhl(0.0)); 386a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 387a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 388a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, log) { 389a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, log(M_E)); 390a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 391a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 392a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, logf) { 393a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0f, logf(static_cast<float>(M_E))); 394a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 395a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 396a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, logl) { 397a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, logl(M_E)); 398a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 399a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 400a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, log2) { 401a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, log2(4096.0)); 402a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 403a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 404a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, log2f) { 405a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0f, log2f(4096.0f)); 406a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 407a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 408a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, log2l) { 409a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, log2l(4096.0)); 410a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 411a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 412a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, log10) { 413a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(3.0, log10(1000.0)); 414a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 415a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 416a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, log10f) { 417a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(3.0f, log10f(1000.0f)); 418a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 419a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 420a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, log10l) { 421a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(3.0, log10l(1000.0)); 422a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 423a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 424a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, cbrt) { 425a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(3.0, cbrt(27.0)); 426a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 427a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 428a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, cbrtf) { 429a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(3.0f, cbrtf(27.0f)); 430a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 431a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 432a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, cbrtl) { 433a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(3.0, cbrtl(27.0)); 434a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 435a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 436a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, sqrt) { 437a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0, sqrt(4.0)); 438a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 439a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 440a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, sqrtf) { 441a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0f, sqrtf(4.0f)); 442a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 443a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 444a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, sqrtl) { 445a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0, sqrtl(4.0)); 446a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 447a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 448a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, exp) { 449a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, exp(0.0)); 450a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(M_E, exp(1.0)); 451a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 452a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 453a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, expf) { 454a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0f, expf(0.0f)); 455a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(static_cast<float>(M_E), expf(1.0f)); 456a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 457a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 458a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, expl) { 459a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, expl(0.0)); 460a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(M_E, expl(1.0)); 461a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 462a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 463a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, exp2) { 464a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(8.0, exp2(3.0)); 465a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 466a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 467a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, exp2f) { 468a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(8.0f, exp2f(3.0f)); 469a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 470a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 471a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, exp2l) { 472a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(8.0, exp2l(3.0)); 473a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 474a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 475a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, expm1) { 476a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(M_E - 1.0, expm1(1.0)); 477a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 478a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 479a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, expm1f) { 480a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(static_cast<float>(M_E) - 1.0f, expm1f(1.0f)); 481a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 482a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 483a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, expm1l) { 484a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(M_E - 1.0, expm1l(1.0)); 485a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 486a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 487a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, pow) { 488a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(8.0, pow(2.0, 3.0)); 489a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 490a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 491a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, powf) { 492a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(8.0f, powf(2.0f, 3.0f)); 493a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 494a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 495a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, powl) { 496a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(8.0, powl(2.0, 3.0)); 497a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 498a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 499a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, ceil) { 500a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, ceil(0.9)); 501a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 502a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 503a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, ceilf) { 504a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0f, ceilf(0.9f)); 505a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 506a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 507a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, ceill) { 508a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, ceill(0.9)); 509a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 510a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 511a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, floor) { 512a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, floor(1.1)); 513a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 514a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 515a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, floorf) { 516a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0f, floorf(1.1f)); 517a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 518a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 519a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, floorl) { 520a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, floorl(1.1)); 521a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 522a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 523a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fabs) { 524a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, fabs(-1.0)); 525a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 526a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 527a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fabsf) { 528a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0f, fabsf(-1.0f)); 529a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 530a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 531a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fabsl) { 532a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, fabsl(-1.0)); 533a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 534a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 535a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, ldexp) { 536a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(16.0, ldexp(2.0, 3.0)); 537a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 538a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 539a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, ldexpf) { 540a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(16.0f, ldexpf(2.0f, 3.0f)); 541a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 542a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 543a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, ldexpl) { 544a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(16.0, ldexpl(2.0, 3.0)); 545a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 546a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 547a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fmod) { 548a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0, fmod(12.0, 10.0)); 549a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 550a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 551a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fmodf) { 552a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0f, fmodf(12.0f, 10.0f)); 553a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 554a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 555a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fmodl) { 556a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0, fmodl(12.0, 10.0)); 557a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 558a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 559a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, remainder) { 560a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0, remainder(12.0, 10.0)); 561a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 562a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 563a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, remainderf) { 564a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0f, remainderf(12.0f, 10.0f)); 565a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 566a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 567a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, remainderl) { 568a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0, remainderl(12.0, 10.0)); 569a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 570a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 571a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, drem) { 572a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0, drem(12.0, 10.0)); 573a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 574a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 575a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, dremf) { 576a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0f, dremf(12.0f, 10.0f)); 577a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 578a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 579a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fmax) { 580a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, fmax(12.0, 10.0)); 581a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, fmax(12.0, nan(""))); 582a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, fmax(nan(""), 12.0)); 583a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 584a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 585a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fmaxf) { 586a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0f, fmaxf(12.0f, 10.0f)); 587a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0f, fmaxf(12.0f, nanf(""))); 588a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0f, fmaxf(nanf(""), 12.0f)); 589a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 590a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 591a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fmaxl) { 592a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, fmaxl(12.0, 10.0)); 593a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, fmaxl(12.0, nanl(""))); 594a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, fmaxl(nanl(""), 12.0)); 595a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 596a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 597a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fmin) { 598a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(10.0, fmin(12.0, 10.0)); 599a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, fmin(12.0, nan(""))); 600a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, fmin(nan(""), 12.0)); 601a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 602a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 603a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fminf) { 604a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(10.0f, fminf(12.0f, 10.0f)); 605a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0f, fminf(12.0f, nanf(""))); 606a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0f, fminf(nanf(""), 12.0f)); 607a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 608a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 609a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fminl) { 610a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(10.0, fminl(12.0, 10.0)); 611a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, fminl(12.0, nan(""))); 612a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, fminl(nan(""), 12.0)); 613a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 614a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 615a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fma) { 616a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(10.0, fma(2.0, 3.0, 4.0)); 617a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 618a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 619a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fmaf) { 620a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(10.0f, fmaf(2.0f, 3.0f, 4.0f)); 621a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 622a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 623a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fmal) { 624a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(10.0, fmal(2.0, 3.0, 4.0)); 625a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 626a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 627a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, hypot) { 628a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(5.0, hypot(3.0, 4.0)); 629a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 630a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 631a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, hypotf) { 632a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(5.0f, hypotf(3.0f, 4.0f)); 633a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 634a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 635a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, hypotl) { 636a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(5.0, hypotl(3.0, 4.0)); 637a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 638a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 639a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, erf) { 640a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.84270078, erf(1.0)); 641a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 642a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 643a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, erff) { 644a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.84270078f, erff(1.0f)); 645a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 646a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 647a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, erfl) { 648a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.84270078, erfl(1.0)); 649a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 650a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 651a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, erfc) { 652a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.15729921, erfc(1.0)); 653a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 654a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 655a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, erfcf) { 656a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.15729921f, erfcf(1.0f)); 657a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 658a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 659a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, erfcl) { 660a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.15729921, erfcl(1.0)); 661a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 662a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 663a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, lrint) { 664a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_UPWARD); // lrint/lrintf/lrintl obey the rounding mode. 665a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1235, lrint(1234.01)); 666a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1235, lrintf(1234.01f)); 667a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1235, lrintl(1234.01)); 668a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_TOWARDZERO); // lrint/lrintf/lrintl obey the rounding mode. 669a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234, lrint(1234.01)); 670a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234, lrintf(1234.01f)); 671a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234, lrintl(1234.01)); 672a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 673a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_UPWARD); // llrint/llrintf/llrintl obey the rounding mode. 674a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1235L, llrint(1234.01)); 675a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1235L, llrintf(1234.01f)); 676a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1235L, llrintl(1234.01)); 677a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_TOWARDZERO); // llrint/llrintf/llrintl obey the rounding mode. 678a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234L, llrint(1234.01)); 679a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234L, llrintf(1234.01f)); 680a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234L, llrintl(1234.01)); 681a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 682a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 683a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, rint) { 684a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_UPWARD); // rint/rintf/rintl obey the rounding mode. 685a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes feclearexcept(FE_ALL_EXCEPT); // rint/rintf/rintl do set the FE_INEXACT flag. 686a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234.0, rint(1234.0)); 687a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0); 688a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1235.0, rint(1234.01)); 689a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) != 0); 690a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 691a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes feclearexcept(FE_ALL_EXCEPT); // rint/rintf/rintl do set the FE_INEXACT flag. 692a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234.0f, rintf(1234.0f)); 693a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0); 694a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1235.0f, rintf(1234.01f)); 695a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) != 0); 696a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 697a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes feclearexcept(FE_ALL_EXCEPT); // rint/rintf/rintl do set the FE_INEXACT flag. 698a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234.0, rintl(1234.0)); 699a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0); 700a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1235.0, rintl(1234.01)); 701a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) != 0); 702a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 703a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_TOWARDZERO); // rint/rintf obey the rounding mode. 704a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234.0, rint(1234.01)); 705a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234.0f, rintf(1234.01f)); 706a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234.0, rintl(1234.01)); 707a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 708a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 709a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, nearbyint) { 710a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_UPWARD); // nearbyint/nearbyintf/nearbyintl obey the rounding mode. 711a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes feclearexcept(FE_ALL_EXCEPT); // nearbyint/nearbyintf/nearbyintl don't set the FE_INEXACT flag. 712a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234.0, nearbyint(1234.0)); 713a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0); 714a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1235.0, nearbyint(1234.01)); 715a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0); 716a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 717a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes feclearexcept(FE_ALL_EXCEPT); 718a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234.0f, nearbyintf(1234.0f)); 719a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0); 720a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1235.0f, nearbyintf(1234.01f)); 721a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0); 722a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 723a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes feclearexcept(FE_ALL_EXCEPT); // nearbyint/nearbyintf/nearbyintl don't set the FE_INEXACT flag. 724a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234.0, nearbyintl(1234.0)); 725a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0); 726a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1235.0, nearbyintl(1234.01)); 727a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0); 728a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 729a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_TOWARDZERO); // nearbyint/nearbyintf/nearbyintl obey the rounding mode. 730a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234.0, nearbyint(1234.01)); 731a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234.0f, nearbyintf(1234.01f)); 732a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234.0, nearbyintl(1234.01)); 733a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 734a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 735a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, lround) { 736a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_UPWARD); // lround ignores the rounding mode. 737a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234, lround(1234.01)); 738a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234, lroundf(1234.01f)); 739a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234, lroundl(1234.01)); 740a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 741a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 742a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, llround) { 743a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_UPWARD); // llround ignores the rounding mode. 744a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234L, llround(1234.01)); 745a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234L, llroundf(1234.01f)); 746a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1234L, llroundl(1234.01)); 747a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 748a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 749a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, ilogb) { 750a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_ILOGB0, ilogb(0.0)); 751a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_ILOGBNAN, ilogb(nan(""))); 752a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(INT_MAX, ilogb(HUGE_VAL)); 753a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, ilogb(1.0)); 754a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(3, ilogb(10.0)); 755a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 756a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 757a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, ilogbf) { 758a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_ILOGB0, ilogbf(0.0f)); 759a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_ILOGBNAN, ilogbf(nanf(""))); 760a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(INT_MAX, ilogbf(HUGE_VALF)); 761a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, ilogbf(1.0f)); 762a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(3, ilogbf(10.0f)); 763a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 764a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 765a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, ilogbl) { 766a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_ILOGB0, ilogbl(0.0)); 767a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(FP_ILOGBNAN, ilogbl(nanl(""))); 768a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(INT_MAX, ilogbl(HUGE_VALL)); 769a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0, ilogbl(1.0)); 770a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(3, ilogbl(10.0)); 771a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 772a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 773a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, logb) { 774a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(-HUGE_VAL, logb(0.0)); 775a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnan(logb(nan("")))); 776a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isinf(logb(HUGE_VAL))); 777a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0.0, logb(1.0)); 778a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(3.0, logb(10.0)); 779a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 780a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 781a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, logbf) { 782a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(-HUGE_VALF, logbf(0.0f)); 783a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnanf(logbf(nanf("")))); 784a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(__isinff(logbf(HUGE_VALF))); 785a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0.0f, logbf(1.0f)); 786a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(3.0f, logbf(10.0f)); 787a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 788a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 789a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, logbl) { 790a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(-HUGE_VAL, logbl(0.0)); 791a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnan(logbl(nanl("")))); 792a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isinf(logbl(HUGE_VALL))); 793a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(0.0, logbl(1.0)); 794a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(3.0, logbl(10.0)); 795a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 796a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 797a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, log1p) { 798a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(-HUGE_VAL, log1p(-1.0)); 799a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnan(log1p(nan("")))); 800a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isinf(log1p(HUGE_VAL))); 801a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, log1p(M_E - 1.0)); 802a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 803a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 804a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, log1pf) { 805a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(-HUGE_VALF, log1pf(-1.0f)); 806a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnanf(log1pf(nanf("")))); 807a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(__isinff(log1pf(HUGE_VALF))); 808a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0f, log1pf(static_cast<float>(M_E) - 1.0f)); 809a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 810a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 811a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, log1pl) { 812a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(-HUGE_VALL, log1pl(-1.0)); 813a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnan(log1pl(nanl("")))); 814a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isinf(log1pl(HUGE_VALL))); 815a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, log1pl(M_E - 1.0)); 816a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 817a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 818a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fdim) { 819a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, fdim(1.0, 1.0)); 820a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, fdim(2.0, 1.0)); 821a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, fdim(1.0, 2.0)); 822a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 823a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 824a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fdimf) { 825a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, fdimf(1.0f, 1.0f)); 826a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0f, fdimf(2.0f, 1.0f)); 827a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, fdimf(1.0f, 2.0f)); 828a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 829a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 830a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, fdiml) { 831a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, fdiml(1.0, 1.0)); 832a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, fdiml(2.0, 1.0)); 833a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, fdiml(1.0, 2.0)); 834a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 835a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 836a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, round) { 837a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_TOWARDZERO); // round ignores the rounding mode and always rounds away from zero. 838a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, round(0.5)); 839a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-1.0, round(-0.5)); 840a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, round(0.0)); 841a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-0.0, round(-0.0)); 842a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnan(round(nan("")))); 843a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(HUGE_VAL, round(HUGE_VAL)); 844a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 845a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 846a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, roundf) { 847a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_TOWARDZERO); // roundf ignores the rounding mode and always rounds away from zero. 848a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0f, roundf(0.5f)); 849a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-1.0f, roundf(-0.5f)); 850a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, roundf(0.0f)); 851a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-0.0f, roundf(-0.0f)); 852a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnanf(roundf(nanf("")))); 853a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(HUGE_VALF, roundf(HUGE_VALF)); 854a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 855a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 856a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, roundl) { 857a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_TOWARDZERO); // roundl ignores the rounding mode and always rounds away from zero. 858a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, roundl(0.5)); 859a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-1.0, roundl(-0.5)); 860a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, roundl(0.0)); 861a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-0.0, roundl(-0.0)); 862a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnan(roundl(nanl("")))); 863a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(HUGE_VALL, roundl(HUGE_VALL)); 864a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 865a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 866a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, trunc) { 867a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_UPWARD); // trunc ignores the rounding mode and always rounds toward zero. 868a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, trunc(1.5)); 869a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-1.0, trunc(-1.5)); 870a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, trunc(0.0)); 871a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-0.0, trunc(-0.0)); 872a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnan(trunc(nan("")))); 873a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(HUGE_VAL, trunc(HUGE_VAL)); 874a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 875a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 876a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, truncf) { 877a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_UPWARD); // truncf ignores the rounding mode and always rounds toward zero. 878a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0f, truncf(1.5f)); 879a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-1.0f, truncf(-1.5f)); 880a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, truncf(0.0f)); 881a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-0.0f, truncf(-0.0f)); 882a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnan(truncf(nanf("")))); 883a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(HUGE_VALF, truncf(HUGE_VALF)); 884a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 885a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 886a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, truncl) { 887a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes fesetround(FE_UPWARD); // truncl ignores the rounding mode and always rounds toward zero. 888a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, truncl(1.5)); 889a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-1.0, truncl(-1.5)); 890a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, truncl(0.0)); 891a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-0.0, truncl(-0.0)); 892a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_TRUE(isnan(truncl(nan("")))); 893a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(HUGE_VALL, truncl(HUGE_VALL)); 894a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 895a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 896a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, nextafter) { 897a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, nextafter(0.0, 0.0)); 898a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.4012985e-45, nextafter(0.0, 1.0)); 899a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, nextafter(0.0, -1.0)); 900a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 901a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 902a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, nextafterf) { 903a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, nextafterf(0.0f, 0.0f)); 904a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.4012985e-45f, nextafterf(0.0f, 1.0f)); 905a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, nextafterf(0.0f, -1.0f)); 906a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 907a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 908a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, nextafterl) { 909a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, nextafterl(0.0, 0.0)); 910a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.4012985e-45, nextafterl(0.0, 1.0)); 911a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, nextafterl(0.0, -1.0)); 912a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 913a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 914a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes// TODO: nexttoward 915a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes// TODO: nexttowardf 916a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes// TODO: nexttowardl 917a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 918a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, copysign) { 919a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, copysign(0.0, 1.0)); 920a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-0.0, copysign(0.0, -1.0)); 921a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0, copysign(2.0, 1.0)); 922a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-2.0, copysign(2.0, -1.0)); 923a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 924a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 925a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, copysignf) { 926a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, copysignf(0.0f, 1.0f)); 927a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-0.0f, copysignf(0.0f, -1.0f)); 928a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0f, copysignf(2.0f, 1.0f)); 929a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-2.0f, copysignf(2.0f, -1.0f)); 930a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 931a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 932a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, copysignl) { 933a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, copysignl(0.0, 1.0)); 934a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-0.0f, copysignl(0.0, -1.0)); 935a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(2.0f, copysignl(2.0, 1.0)); 936a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-2.0f, copysignl(2.0, -1.0)); 937a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 938a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 939a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, significand) { 940a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, significand(0.0)); 941a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.2, significand(1.2)); 942a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.5375, significand(12.3)); 943a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 944a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 945a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, significandf) { 946a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, significandf(0.0f)); 947a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.2f, significandf(1.2f)); 948a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.5375f, significandf(12.3f)); 949a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 950a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 951a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughesextern "C" long double significandl(long double); // BSD's <math.h> doesn't declare this. 952a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 953a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, significandl) { 954a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, significandl(0.0)); 955a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.2, significandl(1.2)); 956a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.5375, significandl(12.3)); 957a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 958a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 959a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, scalb) { 960a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, scalb(3.0, 2.0)); 961a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 962a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 963a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, scalbf) { 964a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0f, scalbf(3.0f, 2.0f)); 965a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 966a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 967a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, scalbln) { 968a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, scalbln(3.0, 2L)); 969a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 970a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 971a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, scalblnf) { 972a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0f, scalblnf(3.0f, 2L)); 973a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 974a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 975a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, scalblnl) { 976a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, scalblnl(3.0, 2L)); 977a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 978a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 979a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, scalbn) { 980a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, scalbn(3.0, 2)); 981a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 982a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 983a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, scalbnf) { 984a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0f, scalbnf(3.0f, 2)); 985a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 986a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 987a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, scalbnl) { 988a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(12.0, scalbnl(3.0, 2)); 989a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 990a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 991a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, gamma) { 992a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(log(24.0), gamma(5.0)); 993a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 994a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 995a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, gammaf) { 996a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(logf(24.0f), gammaf(5.0f)); 997a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 998a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 999a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#if defined(__BIONIC__) 1000a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, gamma_r) { 1001a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes int sign; 1002a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(log(24.0), gamma_r(5.0, &sign)); 1003a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1, sign); 1004a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1005a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#endif 1006a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1007a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#if defined(__BIONIC__) 1008a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, gammaf_r) { 1009a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes int sign; 1010a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(logf(24.0f), gammaf_r(5.0f, &sign)); 1011a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1, sign); 1012a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1013a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes#endif 1014a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1015a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, lgamma) { 1016a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(log(24.0), lgamma(5.0)); 1017a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1018a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1019a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, lgammaf) { 1020a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(logf(24.0f), lgammaf(5.0f)); 1021a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1022a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1023a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, lgammal) { 1024a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(logl(24.0), lgammal(5.0)); 1025a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1026a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1027a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, lgamma_r) { 1028a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes int sign; 1029a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(log(24.0), lgamma_r(5.0, &sign)); 1030a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1, sign); 1031a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1032a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1033a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, lgammaf_r) { 1034a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes int sign; 1035a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(logf(24.0f), lgammaf_r(5.0f, &sign)); 1036a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(1, sign); 1037a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1038a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1039a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, tgamma) { 1040a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(24.0, tgamma(5.0)); 1041a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1042a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1043a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, tgammaf) { 1044a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(24.0f, tgammaf(5.0f)); 1045a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1046a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1047a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, tgammal) { 1048a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(24.0, tgammal(5.0)); 1049a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1050a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1051a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, j0) { 1052a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, j0(0.0)); 1053a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.76519769, j0(1.0)); 1054a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1055a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1056a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, j0f) { 1057a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0f, j0f(0.0f)); 1058a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.76519769f, j0f(1.0f)); 1059a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1060a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1061a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, j1) { 1062a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, j1(0.0)); 1063a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.44005057, j1(1.0)); 1064a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1065a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1066a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, j1f) { 1067a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, j1f(0.0f)); 1068a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.44005057f, j1f(1.0f)); 1069a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1070a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1071a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, jn) { 1072a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0, jn(4, 0.0)); 1073a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0024766389, jn(4, 1.0)); 1074a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1075a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1076a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, jnf) { 1077a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0f, jnf(4, 0.0f)); 1078a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.0024766389f, jnf(4, 1.0f)); 1079a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1080a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1081a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, y0) { 1082a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-HUGE_VAL, y0(0.0)); 1083a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.088256963, y0(1.0)); 1084a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1085a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1086a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, y0f) { 1087a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-HUGE_VALF, y0f(0.0f)); 1088a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.088256963f, y0f(1.0f)); 1089a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1090a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1091a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, y1) { 1092a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-HUGE_VAL, y1(0.0)); 1093a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-0.78121281, y1(1.0)); 1094a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1095a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1096a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, y1f) { 1097a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-HUGE_VALF, y1f(0.0f)); 1098a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-0.78121281f, y1f(1.0f)); 1099a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1100a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1101a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, yn) { 1102a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-HUGE_VAL, yn(4, 0.0)); 1103a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-33.278423, yn(4, 1.0)); 1104a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1105a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1106a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, ynf) { 1107a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-HUGE_VALF, ynf(4, 0.0f)); 1108a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(-33.278423f, ynf(4, 1.0f)); 1109a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1110a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1111a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, frexp) { 1112a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes int exp; 1113a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes double dr = frexp(1024.0, &exp); 1114a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1024.0, scalbn(dr, exp)); 1115a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1116a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1117a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, frexpf) { 1118a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes int exp; 1119a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes float fr = frexpf(1024.0f, &exp); 1120a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1024.0f, scalbnf(fr, exp)); 1121a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1122a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1123a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, frexpl) { 1124a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes int exp; 1125a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes long double ldr = frexpl(1024.0, &exp); 1126a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1024.0, scalbnl(ldr, exp)); 1127a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1128a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1129a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, modf) { 1130a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes double di; 1131a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes double df = modf(123.456, &di); 1132a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(123.0, di); 1133a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.456, df); 1134a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1135a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1136a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, modff) { 1137a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes float fi; 1138a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes float ff = modff(123.456f, &fi); 1139a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(123.0f, fi); 1140a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.45600128f, ff); 1141a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1142a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1143a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, modfl) { 1144a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes long double ldi; 1145a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes long double ldf = modfl(123.456, &ldi); 1146a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(123.0, ldi); 1147a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(0.456, ldf); 1148a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1149a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1150a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, remquo) { 1151a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes int q; 1152a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes double d = remquo(13.0, 4.0, &q); 1153a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(3, q); 1154a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, d); 1155a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1156a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1157a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, remquof) { 1158a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes int q; 1159a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes float f = remquof(13.0f, 4.0f, &q); 1160a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(3, q); 1161a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, f); 1162a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1163a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1164a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, remquol) { 1165a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes int q; 1166a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes long double ld = remquol(13.0, 4.0, &q); 1167a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_EQ(3, q); 1168a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(1.0, ld); 1169a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1170a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes 1171a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes// https://code.google.com/p/android/issues/detail?id=6697 1172a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott HughesTEST(math, frexpf_public_bug_6697) { 1173a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes int exp; 1174a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes float fr = frexpf(14.1f, &exp); 1175a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes ASSERT_FLOAT_EQ(14.1f, scalbnf(fr, exp)); 1176a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes} 1177