• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #define _GNU_SOURCE 1
18 #include <math.h>
19 
20 // This include (and the associated definition of __test_capture_signbit)
21 // must be placed before any files that include <cmath> (gtest.h in this case).
22 //
23 // <math.h> is required to define generic macros signbit, isfinite and
24 // several other such functions.
25 //
26 // <cmath> is required to undef declarations of these macros in the global
27 // namespace and make equivalent functions available in namespace std. Our
28 // stlport implementation does this only for signbit, isfinite, isinf and
29 // isnan.
30 //
31 // NOTE: We don't write our test using std::signbit because we want to be
32 // sure that we're testing the bionic version of signbit. The C++ libraries
33 // are free to reimplement signbit or delegate to compiler builtins if they
34 // please.
35 
36 namespace {
test_capture_signbit(const T in)37 template<typename T> inline int test_capture_signbit(const T in) {
38   return signbit(in);
39 }
test_capture_isfinite(const T in)40 template<typename T> inline int test_capture_isfinite(const T in) {
41   return isfinite(in);
42 }
test_capture_isnan(const T in)43 template<typename T> inline int test_capture_isnan(const T in) {
44   return isnan(in);
45 }
test_capture_isinf(const T in)46 template<typename T> inline int test_capture_isinf(const T in) {
47   return isinf(in);
48 }
49 }
50 
51 #if defined(__BIONIC_LP32_USE_LONG_DOUBLE)
52 #define MATH_TEST math_h_force_long_double
53 #else
54 #define MATH_TEST math_h
55 #endif
56 
57 #include "math_data_test.h"
58 
59 #include <gtest/gtest.h>
60 
61 #include <fenv.h>
62 #include <float.h>
63 #include <limits.h>
64 #include <stdint.h>
65 
66 #include <android-base/scopeguard.h>
67 
float_subnormal()68 static float float_subnormal() {
69   union {
70     float f;
71     uint32_t i;
72   } u;
73   u.i = 0x007fffff;
74   return u.f;
75 }
76 
double_subnormal()77 static double double_subnormal() {
78   union {
79     double d;
80     uint64_t i;
81   } u;
82   u.i = 0x000fffffffffffffLL;
83   return u.d;
84 }
85 
ldouble_subnormal()86 static long double ldouble_subnormal() {
87   union {
88     long double e;
89     unsigned char c[sizeof(long double)];
90   } u;
91 
92   // Subnormals must have a zero exponent and non zero significand.
93   // On all supported representation the 17 bit (counting from either sides)
94   // is part of the significand so it should be enough to set that.
95   // It also applies for the case sizeof(double) = sizeof(long double)
96   for (unsigned int i = 0; i < sizeof(long double); i++) {
97     u.c[i] = 0x00;
98   }
99   u.c[sizeof(long double) - 3] = 0x80;
100   u.c[2] = 0x80;
101 
102   return u.e;
103 }
104 
TEST(MATH_TEST,fpclassify)105 TEST(MATH_TEST, fpclassify) {
106   ASSERT_EQ(FP_INFINITE, fpclassify(INFINITY));
107   ASSERT_EQ(FP_INFINITE, fpclassify(HUGE_VALF));
108   ASSERT_EQ(FP_INFINITE, fpclassify(HUGE_VAL));
109   ASSERT_EQ(FP_INFINITE, fpclassify(HUGE_VALL));
110 
111   ASSERT_EQ(FP_NAN, fpclassify(nanf("")));
112   ASSERT_EQ(FP_NAN, fpclassify(nan("")));
113   ASSERT_EQ(FP_NAN, fpclassify(nanl("")));
114 
115   ASSERT_EQ(FP_NORMAL, fpclassify(1.0f));
116   ASSERT_EQ(FP_NORMAL, fpclassify(1.0));
117   ASSERT_EQ(FP_NORMAL, fpclassify(1.0L));
118 
119   ASSERT_EQ(FP_SUBNORMAL, fpclassify(float_subnormal()));
120   ASSERT_EQ(FP_SUBNORMAL, fpclassify(double_subnormal()));
121   ASSERT_EQ(FP_SUBNORMAL, fpclassify(ldouble_subnormal()));
122 
123   ASSERT_EQ(FP_ZERO, fpclassify(0.0f));
124   ASSERT_EQ(FP_ZERO, fpclassify(0.0));
125   ASSERT_EQ(FP_ZERO, fpclassify(0.0L));
126 }
127 
TEST(MATH_TEST,isfinite)128 TEST(MATH_TEST, isfinite) {
129   ASSERT_TRUE(test_capture_isfinite(123.0f));
130   ASSERT_TRUE(test_capture_isfinite(123.0));
131   ASSERT_TRUE(test_capture_isfinite(123.0L));
132   ASSERT_FALSE(test_capture_isfinite(HUGE_VALF));
133   ASSERT_FALSE(test_capture_isfinite(HUGE_VAL));
134   ASSERT_FALSE(test_capture_isfinite(HUGE_VALL));
135 }
136 
TEST(MATH_TEST,isinf)137 TEST(MATH_TEST, isinf) {
138   ASSERT_FALSE(test_capture_isinf(123.0f));
139   ASSERT_FALSE(test_capture_isinf(123.0));
140   ASSERT_FALSE(test_capture_isinf(123.0L));
141   ASSERT_TRUE(test_capture_isinf(HUGE_VALF));
142   ASSERT_TRUE(test_capture_isinf(HUGE_VAL));
143   ASSERT_TRUE(test_capture_isinf(HUGE_VALL));
144 }
145 
TEST(MATH_TEST,isnan)146 TEST(MATH_TEST, isnan) {
147   ASSERT_FALSE(test_capture_isnan(123.0f));
148   ASSERT_FALSE(test_capture_isnan(123.0));
149   ASSERT_FALSE(test_capture_isnan(123.0L));
150   ASSERT_TRUE(test_capture_isnan(nanf("")));
151   ASSERT_TRUE(test_capture_isnan(nan("")));
152   ASSERT_TRUE(test_capture_isnan(nanl("")));
153 }
154 
TEST(MATH_TEST,isnormal)155 TEST(MATH_TEST, isnormal) {
156   ASSERT_TRUE(isnormal(123.0f));
157   ASSERT_TRUE(isnormal(123.0));
158   ASSERT_TRUE(isnormal(123.0L));
159   ASSERT_FALSE(isnormal(float_subnormal()));
160   ASSERT_FALSE(isnormal(double_subnormal()));
161   ASSERT_FALSE(isnormal(ldouble_subnormal()));
162 }
163 
164 // TODO: isgreater, isgreaterequals, isless, islessequal, islessgreater, isunordered
TEST(MATH_TEST,signbit)165 TEST(MATH_TEST, signbit) {
166   ASSERT_EQ(0, test_capture_signbit(0.0f));
167   ASSERT_EQ(0, test_capture_signbit(0.0));
168   ASSERT_EQ(0, test_capture_signbit(0.0L));
169 
170   ASSERT_EQ(0, test_capture_signbit(1.0f));
171   ASSERT_EQ(0, test_capture_signbit(1.0));
172   ASSERT_EQ(0, test_capture_signbit(1.0L));
173 
174   ASSERT_NE(0, test_capture_signbit(-1.0f));
175   ASSERT_NE(0, test_capture_signbit(-1.0));
176   ASSERT_NE(0, test_capture_signbit(-1.0L));
177 }
178 
179 // Historical BSD cruft that isn't exposed in <math.h> any more.
180 extern "C" int __fpclassify(double);
181 extern "C" int __fpclassifyd(double);
182 extern "C" int __fpclassifyf(float);
183 extern "C" int __fpclassifyl(long double);
184 
TEST(MATH_TEST,__fpclassify)185 TEST(MATH_TEST, __fpclassify) {
186   ASSERT_EQ(FP_INFINITE, __fpclassify(HUGE_VAL));
187   ASSERT_EQ(FP_NAN, __fpclassify(nan("")));
188   ASSERT_EQ(FP_NORMAL, __fpclassify(1.0));
189   ASSERT_EQ(FP_SUBNORMAL, __fpclassify(double_subnormal()));
190   ASSERT_EQ(FP_ZERO, __fpclassify(0.0));
191 }
192 
TEST(MATH_TEST,__fpclassifyd)193 TEST(MATH_TEST, __fpclassifyd) {
194 #if defined(__GLIBC__)
195 #define __fpclassifyd __fpclassify
196 #endif
197   ASSERT_EQ(FP_INFINITE, __fpclassifyd(HUGE_VAL));
198   ASSERT_EQ(FP_NAN, __fpclassifyd(nan("")));
199   ASSERT_EQ(FP_NORMAL, __fpclassifyd(1.0));
200   ASSERT_EQ(FP_SUBNORMAL, __fpclassifyd(double_subnormal()));
201   ASSERT_EQ(FP_ZERO, __fpclassifyd(0.0));
202 }
203 
TEST(MATH_TEST,__fpclassifyf)204 TEST(MATH_TEST, __fpclassifyf) {
205   ASSERT_EQ(FP_INFINITE, __fpclassifyf(HUGE_VALF));
206   ASSERT_EQ(FP_NAN, __fpclassifyf(nanf("")));
207   ASSERT_EQ(FP_NORMAL, __fpclassifyf(1.0f));
208   ASSERT_EQ(FP_SUBNORMAL, __fpclassifyf(float_subnormal()));
209   ASSERT_EQ(FP_ZERO, __fpclassifyf(0.0f));
210 }
211 
TEST(MATH_TEST,__fpclassifyl)212 TEST(MATH_TEST, __fpclassifyl) {
213   EXPECT_EQ(FP_INFINITE, __fpclassifyl(HUGE_VALL));
214   EXPECT_EQ(FP_NAN, __fpclassifyl(nanl("")));
215   EXPECT_EQ(FP_NORMAL, __fpclassifyl(1.0L));
216   EXPECT_EQ(FP_SUBNORMAL, __fpclassifyl(ldouble_subnormal()));
217   EXPECT_EQ(FP_ZERO, __fpclassifyl(0.0L));
218 }
219 
TEST(MATH_TEST,finitef)220 TEST(MATH_TEST, finitef) {
221   ASSERT_TRUE(finitef(123.0f));
222   ASSERT_FALSE(finitef(HUGE_VALF));
223 }
224 
225 // Historical BSD cruft that isn't exposed in <math.h> any more.
226 extern "C" int __isfinite(double);
227 extern "C" int __isfinitef(float);
228 extern "C" int isfinitef(float);
229 extern "C" int __isfinitel(long double);
230 extern "C" int isfinitel(long double);
231 
TEST(MATH_TEST,__isfinite)232 TEST(MATH_TEST, __isfinite) {
233 #if defined(__GLIBC__)
234 #define __isfinite __finite
235 #endif
236   ASSERT_TRUE(__isfinite(123.0));
237   ASSERT_FALSE(__isfinite(HUGE_VAL));
238 }
239 
TEST(MATH_TEST,__isfinitef)240 TEST(MATH_TEST, __isfinitef) {
241 #if defined(__GLIBC__)
242 #define __isfinitef __finitef
243 #endif
244   ASSERT_TRUE(__isfinitef(123.0f));
245   ASSERT_FALSE(__isfinitef(HUGE_VALF));
246 }
247 
TEST(MATH_TEST,isfinitef)248 TEST(MATH_TEST, isfinitef) {
249 #if defined(__GLIBC__)
250 #define isfinitef __finitef
251 #endif
252   ASSERT_TRUE(isfinitef(123.0f));
253   ASSERT_FALSE(isfinitef(HUGE_VALF));
254 }
255 
TEST(MATH_TEST,__isfinitel)256 TEST(MATH_TEST, __isfinitel) {
257 #if defined(__GLIBC__)
258 #define __isfinitel __finitel
259 #endif
260   ASSERT_TRUE(__isfinitel(123.0L));
261   ASSERT_FALSE(__isfinitel(HUGE_VALL));
262 }
263 
TEST(MATH_TEST,isfinitel)264 TEST(MATH_TEST, isfinitel) {
265 #if defined(__GLIBC__)
266 #define isfinitel __finitel
267 #endif
268   ASSERT_TRUE(isfinitel(123.0L));
269   ASSERT_FALSE(isfinitel(HUGE_VALL));
270 }
271 
TEST(MATH_TEST,finite)272 TEST(MATH_TEST, finite) {
273   ASSERT_TRUE(finite(123.0));
274   ASSERT_FALSE(finite(HUGE_VAL));
275 }
276 
TEST(MATH_TEST,isinf_function)277 TEST(MATH_TEST, isinf_function) {
278   // The isinf macro deals with all three types; the isinf function is for doubles.
279   ASSERT_FALSE((isinf)(123.0));
280   ASSERT_TRUE((isinf)(HUGE_VAL));
281 }
282 
283 // Historical BSD cruft that isn't exposed in <math.h> any more.
284 extern "C" int __isinf(double);
285 extern "C" int __isinff(float);
286 extern "C" int isinff(float);
287 extern "C" int __isinfl(long double);
288 extern "C" int isinfl(long double);
289 
TEST(MATH_TEST,__isinf)290 TEST(MATH_TEST, __isinf) {
291   ASSERT_FALSE(__isinf(123.0));
292   ASSERT_TRUE(__isinf(HUGE_VAL));
293 }
294 
TEST(MATH_TEST,__isinff)295 TEST(MATH_TEST, __isinff) {
296   ASSERT_FALSE(__isinff(123.0f));
297   ASSERT_TRUE(__isinff(HUGE_VALF));
298 }
299 
TEST(MATH_TEST,isinff)300 TEST(MATH_TEST, isinff) {
301   ASSERT_FALSE(isinff(123.0f));
302   ASSERT_TRUE(isinff(HUGE_VALF));
303 }
304 
TEST(MATH_TEST,__isinfl)305 TEST(MATH_TEST, __isinfl) {
306   ASSERT_FALSE(__isinfl(123.0L));
307   ASSERT_TRUE(__isinfl(HUGE_VALL));
308 }
309 
TEST(MATH_TEST,isinfl)310 TEST(MATH_TEST, isinfl) {
311   ASSERT_FALSE(isinfl(123.0L));
312   ASSERT_TRUE(isinfl(HUGE_VALL));
313 }
314 
TEST(MATH_TEST,isnan_function)315 TEST(MATH_TEST, isnan_function) {
316   // The isnan macro deals with all three types; the isnan function is for doubles.
317   ASSERT_FALSE((isnan)(123.0));
318   ASSERT_TRUE((isnan)(nan("")));
319 }
320 
321 // Historical BSD cruft that isn't exposed in <math.h> any more.
322 extern "C" int __isnan(double);
323 extern "C" int __isnanf(float);
324 extern "C" int isnanf(float);
325 extern "C" int __isnanl(long double);
326 extern "C" int isnanl(long double);
327 
TEST(MATH_TEST,__isnan)328 TEST(MATH_TEST, __isnan) {
329   ASSERT_FALSE(__isnan(123.0));
330   ASSERT_TRUE(__isnan(nan("")));
331 }
332 
TEST(MATH_TEST,__isnanf)333 TEST(MATH_TEST, __isnanf) {
334   ASSERT_FALSE(__isnanf(123.0f));
335   ASSERT_TRUE(__isnanf(nanf("")));
336 }
337 
TEST(MATH_TEST,isnanf)338 TEST(MATH_TEST, isnanf) {
339   ASSERT_FALSE(isnanf(123.0f));
340   ASSERT_TRUE(isnanf(nanf("")));
341 }
342 
TEST(MATH_TEST,__isnanl)343 TEST(MATH_TEST, __isnanl) {
344   ASSERT_FALSE(__isnanl(123.0L));
345   ASSERT_TRUE(__isnanl(nanl("")));
346 }
347 
TEST(MATH_TEST,isnanl)348 TEST(MATH_TEST, isnanl) {
349   ASSERT_FALSE(isnanl(123.0L));
350   ASSERT_TRUE(isnanl(nanl("")));
351 }
352 
353 // Historical BSD cruft that isn't exposed in <math.h> any more.
354 extern "C" int __isnormal(double);
355 extern "C" int __isnormalf(float);
356 extern "C" int isnormalf(float);
357 extern "C" int __isnormall(long double);
358 extern "C" int isnormall(long double);
359 
TEST(MATH_TEST,__isnormal)360 TEST(MATH_TEST, __isnormal) {
361 #if defined(__BIONIC__)
362   ASSERT_TRUE(__isnormal(123.0));
363   ASSERT_FALSE(__isnormal(double_subnormal()));
364 #else // __BIONIC__
365   GTEST_LOG_(INFO) << "glibc doesn't have __isnormal.\n";
366 #endif // __BIONIC__
367 }
368 
TEST(MATH_TEST,__isnormalf)369 TEST(MATH_TEST, __isnormalf) {
370 #if defined(__BIONIC__)
371   ASSERT_TRUE(__isnormalf(123.0f));
372   ASSERT_FALSE(__isnormalf(float_subnormal()));
373 #else // __BIONIC__
374   GTEST_LOG_(INFO) << "glibc doesn't have __isnormalf.\n";
375 #endif // __BIONIC__
376 }
377 
TEST(MATH_TEST,isnormalf)378 TEST(MATH_TEST, isnormalf) {
379 #if defined(__BIONIC__)
380   ASSERT_TRUE(isnormalf(123.0f));
381   ASSERT_FALSE(isnormalf(float_subnormal()));
382 #else // __BIONIC__
383   GTEST_LOG_(INFO) << "glibc doesn't have isnormalf.\n";
384 #endif // __BIONIC__
385 }
386 
TEST(MATH_TEST,__isnormall)387 TEST(MATH_TEST, __isnormall) {
388 #if defined(__BIONIC__)
389   ASSERT_TRUE(__isnormall(123.0L));
390   ASSERT_FALSE(__isnormall(ldouble_subnormal()));
391 #else // __BIONIC__
392   GTEST_LOG_(INFO) << "glibc doesn't have __isnormall.\n";
393 #endif // __BIONIC__
394 }
395 
TEST(MATH_TEST,isnormall)396 TEST(MATH_TEST, isnormall) {
397 #if defined(__BIONIC__)
398   ASSERT_TRUE(isnormall(123.0L));
399   ASSERT_FALSE(isnormall(ldouble_subnormal()));
400 #else // __BIONIC__
401   GTEST_LOG_(INFO) << "glibc doesn't have isnormall.\n";
402 #endif // __BIONIC__
403 }
404 
405 // Historical BSD cruft that isn't exposed in <math.h> any more.
406 extern "C" int __signbit(double);
407 extern "C" int __signbitf(float);
408 extern "C" int __signbitl(long double);
409 
TEST(MATH_TEST,__signbit)410 TEST(MATH_TEST, __signbit) {
411   ASSERT_EQ(0, __signbit(0.0));
412   ASSERT_EQ(0, __signbit(1.0));
413   ASSERT_NE(0, __signbit(-1.0));
414 }
415 
TEST(MATH_TEST,__signbitf)416 TEST(MATH_TEST, __signbitf) {
417   ASSERT_EQ(0, __signbitf(0.0f));
418   ASSERT_EQ(0, __signbitf(1.0f));
419   ASSERT_NE(0, __signbitf(-1.0f));
420 }
421 
TEST(MATH_TEST,__signbitl)422 TEST(MATH_TEST, __signbitl) {
423   ASSERT_EQ(0L, __signbitl(0.0L));
424   ASSERT_EQ(0L, __signbitl(1.0L));
425   ASSERT_NE(0L, __signbitl(-1.0L));
426 }
427 
TEST(MATH_TEST,acos)428 TEST(MATH_TEST, acos) {
429   ASSERT_DOUBLE_EQ(M_PI/2.0, acos(0.0));
430 }
431 
TEST(MATH_TEST,acosf)432 TEST(MATH_TEST, acosf) {
433   ASSERT_FLOAT_EQ(static_cast<float>(M_PI)/2.0f, acosf(0.0f));
434 }
435 
TEST(MATH_TEST,acosl)436 TEST(MATH_TEST, acosl) {
437   ASSERT_DOUBLE_EQ(M_PI/2.0L, acosl(0.0L));
438 }
439 
TEST(MATH_TEST,asin)440 TEST(MATH_TEST, asin) {
441   ASSERT_DOUBLE_EQ(0.0, asin(0.0));
442 }
443 
TEST(MATH_TEST,asinf)444 TEST(MATH_TEST, asinf) {
445   ASSERT_FLOAT_EQ(0.0f, asinf(0.0f));
446 }
447 
TEST(MATH_TEST,asinl)448 TEST(MATH_TEST, asinl) {
449   ASSERT_DOUBLE_EQ(0.0L, asinl(0.0L));
450 }
451 
TEST(MATH_TEST,atan)452 TEST(MATH_TEST, atan) {
453   ASSERT_DOUBLE_EQ(0.0, atan(0.0));
454 }
455 
TEST(MATH_TEST,atanf)456 TEST(MATH_TEST, atanf) {
457   ASSERT_FLOAT_EQ(0.0f, atanf(0.0f));
458 }
459 
TEST(MATH_TEST,atanl)460 TEST(MATH_TEST, atanl) {
461   ASSERT_DOUBLE_EQ(0.0L, atanl(0.0L));
462 }
463 
TEST(MATH_TEST,atan2)464 TEST(MATH_TEST, atan2) {
465   ASSERT_DOUBLE_EQ(0.0, atan2(0.0, 0.0));
466 }
467 
TEST(MATH_TEST,atan2f)468 TEST(MATH_TEST, atan2f) {
469   ASSERT_FLOAT_EQ(0.0f, atan2f(0.0f, 0.0f));
470 }
471 
TEST(MATH_TEST,atan2l)472 TEST(MATH_TEST, atan2l) {
473   ASSERT_DOUBLE_EQ(0.0L, atan2l(0.0L, 0.0L));
474 }
475 
TEST(MATH_TEST,cos)476 TEST(MATH_TEST, cos) {
477   ASSERT_DOUBLE_EQ(1.0, cos(0.0));
478 }
479 
TEST(MATH_TEST,cosf)480 TEST(MATH_TEST, cosf) {
481   ASSERT_FLOAT_EQ(1.0f, cosf(0.0f));
482 }
483 
TEST(MATH_TEST,cosl)484 TEST(MATH_TEST, cosl) {
485   ASSERT_DOUBLE_EQ(1.0L, cosl(0.0L));
486 }
487 
TEST(MATH_TEST,sin)488 TEST(MATH_TEST, sin) {
489   ASSERT_DOUBLE_EQ(0.0, sin(0.0));
490 }
491 
TEST(MATH_TEST,sinf)492 TEST(MATH_TEST, sinf) {
493   ASSERT_FLOAT_EQ(0.0f, sinf(0.0f));
494 }
495 
TEST(MATH_TEST,sinl)496 TEST(MATH_TEST, sinl) {
497   ASSERT_DOUBLE_EQ(0.0L, sinl(0.0L));
498 }
499 
TEST(MATH_TEST,sincos)500 TEST(MATH_TEST, sincos) {
501   double s, c;
502   sincos(0.0, &s, &c);
503   ASSERT_DOUBLE_EQ(0.0, s);
504   ASSERT_DOUBLE_EQ(1.0, c);
505 }
506 
TEST(MATH_TEST,sincosf)507 TEST(MATH_TEST, sincosf) {
508   float s, c;
509   sincosf(0.0f, &s, &c);
510   ASSERT_FLOAT_EQ(0.0f, s);
511   ASSERT_FLOAT_EQ(1.0f, c);
512 }
513 
TEST(MATH_TEST,sincosl)514 TEST(MATH_TEST, sincosl) {
515   long double s, c;
516   sincosl(0.0L, &s, &c);
517   ASSERT_DOUBLE_EQ(0.0L, s);
518   ASSERT_DOUBLE_EQ(1.0L, c);
519 }
520 
TEST(MATH_TEST,tan)521 TEST(MATH_TEST, tan) {
522   ASSERT_DOUBLE_EQ(0.0, tan(0.0));
523 }
524 
TEST(MATH_TEST,tanf)525 TEST(MATH_TEST, tanf) {
526   ASSERT_FLOAT_EQ(0.0f, tanf(0.0f));
527 }
528 
TEST(MATH_TEST,tanl)529 TEST(MATH_TEST, tanl) {
530   ASSERT_DOUBLE_EQ(0.0L, tanl(0.0L));
531 }
532 
TEST(MATH_TEST,acosh)533 TEST(MATH_TEST, acosh) {
534   ASSERT_DOUBLE_EQ(0.0, acosh(1.0));
535 }
536 
TEST(MATH_TEST,acoshf)537 TEST(MATH_TEST, acoshf) {
538   ASSERT_FLOAT_EQ(0.0f, acoshf(1.0f));
539 }
540 
TEST(MATH_TEST,acoshl)541 TEST(MATH_TEST, acoshl) {
542   ASSERT_DOUBLE_EQ(0.0L, acoshl(1.0L));
543 }
544 
TEST(MATH_TEST,asinh)545 TEST(MATH_TEST, asinh) {
546   ASSERT_DOUBLE_EQ(0.0, asinh(0.0));
547 }
548 
TEST(MATH_TEST,asinhf)549 TEST(MATH_TEST, asinhf) {
550   ASSERT_FLOAT_EQ(0.0f, asinhf(0.0f));
551 }
552 
TEST(MATH_TEST,asinhl)553 TEST(MATH_TEST, asinhl) {
554   ASSERT_DOUBLE_EQ(0.0L, asinhl(0.0L));
555 }
556 
TEST(MATH_TEST,atanh)557 TEST(MATH_TEST, atanh) {
558   ASSERT_DOUBLE_EQ(0.0, atanh(0.0));
559 }
560 
TEST(MATH_TEST,atanhf)561 TEST(MATH_TEST, atanhf) {
562   ASSERT_FLOAT_EQ(0.0f, atanhf(0.0f));
563 }
564 
TEST(MATH_TEST,atanhl)565 TEST(MATH_TEST, atanhl) {
566   ASSERT_DOUBLE_EQ(0.0L, atanhl(0.0L));
567 }
568 
TEST(MATH_TEST,cosh)569 TEST(MATH_TEST, cosh) {
570   ASSERT_DOUBLE_EQ(1.0, cosh(0.0));
571 }
572 
TEST(MATH_TEST,coshf)573 TEST(MATH_TEST, coshf) {
574   ASSERT_FLOAT_EQ(1.0f, coshf(0.0f));
575 }
576 
TEST(MATH_TEST,coshl)577 TEST(MATH_TEST, coshl) {
578   ASSERT_DOUBLE_EQ(1.0L, coshl(0.0L));
579 }
580 
TEST(MATH_TEST,sinh)581 TEST(MATH_TEST, sinh) {
582   ASSERT_DOUBLE_EQ(0.0, sinh(0.0));
583 }
584 
TEST(MATH_TEST,sinhf)585 TEST(MATH_TEST, sinhf) {
586   ASSERT_FLOAT_EQ(0.0f, sinhf(0.0f));
587 }
588 
TEST(MATH_TEST,sinhl)589 TEST(MATH_TEST, sinhl) {
590   ASSERT_DOUBLE_EQ(0.0L, sinhl(0.0L));
591 }
592 
TEST(MATH_TEST,tanh)593 TEST(MATH_TEST, tanh) {
594   ASSERT_DOUBLE_EQ(0.0, tanh(0.0));
595 }
596 
TEST(MATH_TEST,tanhf)597 TEST(MATH_TEST, tanhf) {
598   ASSERT_FLOAT_EQ(0.0f, tanhf(0.0f));
599 }
600 
TEST(MATH_TEST,tanhl)601 TEST(MATH_TEST, tanhl) {
602   ASSERT_DOUBLE_EQ(0.0L, tanhl(0.0L));
603 }
604 
TEST(MATH_TEST,log)605 TEST(MATH_TEST, log) {
606   ASSERT_DOUBLE_EQ(1.0, log(M_E));
607 }
608 
TEST(MATH_TEST,logf)609 TEST(MATH_TEST, logf) {
610   ASSERT_FLOAT_EQ(1.0f, logf(static_cast<float>(M_E)));
611 }
612 
TEST(MATH_TEST,logl)613 TEST(MATH_TEST, logl) {
614   ASSERT_DOUBLE_EQ(1.0L, logl(M_E));
615 }
616 
TEST(MATH_TEST,log2)617 TEST(MATH_TEST, log2) {
618   ASSERT_DOUBLE_EQ(12.0, log2(4096.0));
619 }
620 
TEST(MATH_TEST,log2f)621 TEST(MATH_TEST, log2f) {
622   ASSERT_FLOAT_EQ(12.0f, log2f(4096.0f));
623 }
624 
TEST(MATH_TEST,log2l)625 TEST(MATH_TEST, log2l) {
626   ASSERT_DOUBLE_EQ(12.0L, log2l(4096.0L));
627 }
628 
TEST(MATH_TEST,log10)629 TEST(MATH_TEST, log10) {
630   ASSERT_DOUBLE_EQ(3.0, log10(1000.0));
631 }
632 
TEST(MATH_TEST,log10f)633 TEST(MATH_TEST, log10f) {
634   ASSERT_FLOAT_EQ(3.0f, log10f(1000.0f));
635 }
636 
TEST(MATH_TEST,log10l)637 TEST(MATH_TEST, log10l) {
638   ASSERT_DOUBLE_EQ(3.0L, log10l(1000.0L));
639 }
640 
TEST(MATH_TEST,cbrt)641 TEST(MATH_TEST, cbrt) {
642   ASSERT_DOUBLE_EQ(3.0, cbrt(27.0));
643 }
644 
TEST(MATH_TEST,cbrtf)645 TEST(MATH_TEST, cbrtf) {
646   ASSERT_FLOAT_EQ(3.0f, cbrtf(27.0f));
647 }
648 
TEST(MATH_TEST,cbrtl)649 TEST(MATH_TEST, cbrtl) {
650   ASSERT_DOUBLE_EQ(3.0L, cbrtl(27.0L));
651 }
652 
TEST(MATH_TEST,sqrt)653 TEST(MATH_TEST, sqrt) {
654   ASSERT_DOUBLE_EQ(2.0, sqrt(4.0));
655 }
656 
TEST(MATH_TEST,sqrtf)657 TEST(MATH_TEST, sqrtf) {
658   ASSERT_FLOAT_EQ(2.0f, sqrtf(4.0f));
659 }
660 
TEST(MATH_TEST,sqrtl)661 TEST(MATH_TEST, sqrtl) {
662   ASSERT_DOUBLE_EQ(2.0L, sqrtl(4.0L));
663 }
664 
TEST(MATH_TEST,exp)665 TEST(MATH_TEST, exp) {
666   ASSERT_DOUBLE_EQ(1.0, exp(0.0));
667   ASSERT_DOUBLE_EQ(M_E, exp(1.0));
668 }
669 
TEST(MATH_TEST,expf)670 TEST(MATH_TEST, expf) {
671   ASSERT_FLOAT_EQ(1.0f, expf(0.0f));
672   ASSERT_FLOAT_EQ(static_cast<float>(M_E), expf(1.0f));
673 }
674 
TEST(MATH_TEST,expl)675 TEST(MATH_TEST, expl) {
676   ASSERT_DOUBLE_EQ(1.0L, expl(0.0L));
677   ASSERT_DOUBLE_EQ(M_E, expl(1.0L));
678 }
679 
TEST(MATH_TEST,exp2)680 TEST(MATH_TEST, exp2) {
681   ASSERT_DOUBLE_EQ(8.0, exp2(3.0));
682 }
683 
TEST(MATH_TEST,exp2f)684 TEST(MATH_TEST, exp2f) {
685   ASSERT_FLOAT_EQ(8.0f, exp2f(3.0f));
686 }
687 
TEST(MATH_TEST,exp2l)688 TEST(MATH_TEST, exp2l) {
689   ASSERT_DOUBLE_EQ(8.0L, exp2l(3.0L));
690 }
691 
TEST(MATH_TEST,expm1)692 TEST(MATH_TEST, expm1) {
693   ASSERT_DOUBLE_EQ(M_E - 1.0, expm1(1.0));
694 }
695 
TEST(MATH_TEST,expm1f)696 TEST(MATH_TEST, expm1f) {
697   ASSERT_FLOAT_EQ(static_cast<float>(M_E) - 1.0f, expm1f(1.0f));
698 }
699 
TEST(MATH_TEST,expm1l)700 TEST(MATH_TEST, expm1l) {
701   ASSERT_DOUBLE_EQ(M_E - 1.0L, expm1l(1.0L));
702 }
703 
TEST(MATH_TEST,pow)704 TEST(MATH_TEST, pow) {
705   ASSERT_TRUE(isnan(pow(nan(""), 3.0)));
706   ASSERT_DOUBLE_EQ(1.0, (pow(1.0, nan(""))));
707   ASSERT_TRUE(isnan(pow(2.0, nan(""))));
708   ASSERT_DOUBLE_EQ(8.0, pow(2.0, 3.0));
709 }
710 
TEST(MATH_TEST,powf)711 TEST(MATH_TEST, powf) {
712   ASSERT_TRUE(isnanf(powf(nanf(""), 3.0f)));
713   ASSERT_FLOAT_EQ(1.0f, (powf(1.0f, nanf(""))));
714   ASSERT_TRUE(isnanf(powf(2.0f, nanf(""))));
715   ASSERT_FLOAT_EQ(8.0f, powf(2.0f, 3.0f));
716 }
717 
TEST(MATH_TEST,powl)718 TEST(MATH_TEST, powl) {
719   ASSERT_TRUE(__isnanl(powl(nanl(""), 3.0L)));
720   ASSERT_DOUBLE_EQ(1.0L, (powl(1.0L, nanl(""))));
721   ASSERT_TRUE(__isnanl(powl(2.0L, nanl(""))));
722   ASSERT_DOUBLE_EQ(8.0L, powl(2.0L, 3.0L));
723 }
724 
TEST(MATH_TEST,ceil)725 TEST(MATH_TEST, ceil) {
726   ASSERT_DOUBLE_EQ(1.0, ceil(0.9));
727 }
728 
TEST(MATH_TEST,ceilf)729 TEST(MATH_TEST, ceilf) {
730   ASSERT_FLOAT_EQ(1.0f, ceilf(0.9f));
731 }
732 
TEST(MATH_TEST,ceill)733 TEST(MATH_TEST, ceill) {
734   ASSERT_DOUBLE_EQ(1.0L, ceill(0.9L));
735 }
736 
TEST(MATH_TEST,floor)737 TEST(MATH_TEST, floor) {
738   ASSERT_DOUBLE_EQ(1.0, floor(1.1));
739 }
740 
TEST(MATH_TEST,floorf)741 TEST(MATH_TEST, floorf) {
742   ASSERT_FLOAT_EQ(1.0f, floorf(1.1f));
743 }
744 
TEST(MATH_TEST,floorl)745 TEST(MATH_TEST, floorl) {
746   ASSERT_DOUBLE_EQ(1.0L, floorl(1.1L));
747 }
748 
TEST(MATH_TEST,fabs)749 TEST(MATH_TEST, fabs) {
750   ASSERT_DOUBLE_EQ(1.0, fabs(-1.0));
751 }
752 
TEST(MATH_TEST,fabsf)753 TEST(MATH_TEST, fabsf) {
754   ASSERT_FLOAT_EQ(1.0f, fabsf(-1.0f));
755 }
756 
TEST(MATH_TEST,fabsl)757 TEST(MATH_TEST, fabsl) {
758   ASSERT_DOUBLE_EQ(1.0L, fabsl(-1.0L));
759 }
760 
TEST(MATH_TEST,ldexp)761 TEST(MATH_TEST, ldexp) {
762   ASSERT_DOUBLE_EQ(16.0, ldexp(2.0, 3.0));
763 }
764 
TEST(MATH_TEST,ldexpf)765 TEST(MATH_TEST, ldexpf) {
766   ASSERT_FLOAT_EQ(16.0f, ldexpf(2.0f, 3.0f));
767 }
768 
TEST(MATH_TEST,ldexpl)769 TEST(MATH_TEST, ldexpl) {
770   ASSERT_DOUBLE_EQ(16.0L, ldexpl(2.0L, 3.0));
771 }
772 
TEST(MATH_TEST,fmod)773 TEST(MATH_TEST, fmod) {
774   ASSERT_DOUBLE_EQ(2.0, fmod(12.0, 10.0));
775 }
776 
TEST(MATH_TEST,fmodf)777 TEST(MATH_TEST, fmodf) {
778   ASSERT_FLOAT_EQ(2.0f, fmodf(12.0f, 10.0f));
779 }
780 
TEST(MATH_TEST,fmodl)781 TEST(MATH_TEST, fmodl) {
782   ASSERT_DOUBLE_EQ(2.0L, fmodl(12.0L, 10.0L));
783 }
784 
TEST(MATH_TEST,remainder)785 TEST(MATH_TEST, remainder) {
786   ASSERT_DOUBLE_EQ(2.0, remainder(12.0, 10.0));
787 }
788 
TEST(MATH_TEST,remainderf)789 TEST(MATH_TEST, remainderf) {
790   ASSERT_FLOAT_EQ(2.0f, remainderf(12.0f, 10.0f));
791 }
792 
TEST(MATH_TEST,remainderl)793 TEST(MATH_TEST, remainderl) {
794   ASSERT_DOUBLE_EQ(2.0L, remainderl(12.0L, 10.0L));
795 }
796 
TEST(MATH_TEST,drem)797 TEST(MATH_TEST, drem) {
798   ASSERT_DOUBLE_EQ(2.0, drem(12.0, 10.0));
799 }
800 
TEST(MATH_TEST,dremf)801 TEST(MATH_TEST, dremf) {
802   ASSERT_FLOAT_EQ(2.0f, dremf(12.0f, 10.0f));
803 }
804 
TEST(MATH_TEST,fmax)805 TEST(MATH_TEST, fmax) {
806   ASSERT_DOUBLE_EQ(12.0, fmax(12.0, 10.0));
807   ASSERT_DOUBLE_EQ(12.0, fmax(12.0, nan("")));
808   ASSERT_DOUBLE_EQ(12.0, fmax(nan(""), 12.0));
809 }
810 
TEST(MATH_TEST,fmaxf)811 TEST(MATH_TEST, fmaxf) {
812   ASSERT_FLOAT_EQ(12.0f, fmaxf(12.0f, 10.0f));
813   ASSERT_FLOAT_EQ(12.0f, fmaxf(12.0f, nanf("")));
814   ASSERT_FLOAT_EQ(12.0f, fmaxf(nanf(""), 12.0f));
815 }
816 
TEST(MATH_TEST,fmaxl)817 TEST(MATH_TEST, fmaxl) {
818   ASSERT_DOUBLE_EQ(12.0L, fmaxl(12.0L, 10.0L));
819   ASSERT_DOUBLE_EQ(12.0L, fmaxl(12.0L, nanl("")));
820   ASSERT_DOUBLE_EQ(12.0L, fmaxl(nanl(""), 12.0L));
821 }
822 
TEST(MATH_TEST,fmin)823 TEST(MATH_TEST, fmin) {
824   ASSERT_DOUBLE_EQ(10.0, fmin(12.0, 10.0));
825   ASSERT_DOUBLE_EQ(12.0, fmin(12.0, nan("")));
826   ASSERT_DOUBLE_EQ(12.0, fmin(nan(""), 12.0));
827 }
828 
TEST(MATH_TEST,fminf)829 TEST(MATH_TEST, fminf) {
830   ASSERT_FLOAT_EQ(10.0f, fminf(12.0f, 10.0f));
831   ASSERT_FLOAT_EQ(12.0f, fminf(12.0f, nanf("")));
832   ASSERT_FLOAT_EQ(12.0f, fminf(nanf(""), 12.0f));
833 }
834 
TEST(MATH_TEST,fminl)835 TEST(MATH_TEST, fminl) {
836   ASSERT_DOUBLE_EQ(10.0L, fminl(12.0L, 10.0L));
837   ASSERT_DOUBLE_EQ(12.0L, fminl(12.0L, nanl("")));
838   ASSERT_DOUBLE_EQ(12.0L, fminl(nanl(""), 12.0L));
839 }
840 
TEST(MATH_TEST,fma)841 TEST(MATH_TEST, fma) {
842   ASSERT_DOUBLE_EQ(10.0, fma(2.0, 3.0, 4.0));
843 }
844 
TEST(MATH_TEST,fmaf)845 TEST(MATH_TEST, fmaf) {
846   ASSERT_FLOAT_EQ(10.0f, fmaf(2.0f, 3.0f, 4.0f));
847 }
848 
TEST(MATH_TEST,fmal)849 TEST(MATH_TEST, fmal) {
850   ASSERT_DOUBLE_EQ(10.0L, fmal(2.0L, 3.0L, 4.0L));
851 }
852 
TEST(MATH_TEST,hypot)853 TEST(MATH_TEST, hypot) {
854   ASSERT_DOUBLE_EQ(5.0, hypot(3.0, 4.0));
855 }
856 
TEST(MATH_TEST,hypotf)857 TEST(MATH_TEST, hypotf) {
858   ASSERT_FLOAT_EQ(5.0f, hypotf(3.0f, 4.0f));
859 }
860 
TEST(MATH_TEST,hypotl)861 TEST(MATH_TEST, hypotl) {
862   ASSERT_DOUBLE_EQ(5.0L, hypotl(3.0L, 4.0L));
863 }
864 
TEST(MATH_TEST,erf)865 TEST(MATH_TEST, erf) {
866   ASSERT_DOUBLE_EQ(0.84270079294971489, erf(1.0));
867 }
868 
TEST(MATH_TEST,erff)869 TEST(MATH_TEST, erff) {
870   ASSERT_FLOAT_EQ(0.84270078f, erff(1.0f));
871 }
872 
TEST(MATH_TEST,erfl)873 TEST(MATH_TEST, erfl) {
874   ASSERT_DOUBLE_EQ(0.84270079294971489L, erfl(1.0L));
875 }
876 
TEST(MATH_TEST,erfc)877 TEST(MATH_TEST, erfc) {
878   ASSERT_DOUBLE_EQ(0.15729920705028513, erfc(1.0));
879 }
880 
TEST(MATH_TEST,erfcf)881 TEST(MATH_TEST, erfcf) {
882   ASSERT_FLOAT_EQ(0.15729921f, erfcf(1.0f));
883 }
884 
TEST(MATH_TEST,erfcl)885 TEST(MATH_TEST, erfcl) {
886   ASSERT_DOUBLE_EQ(0.15729920705028513l, erfcl(1.0L));
887 }
888 
TEST(MATH_TEST,lrint)889 TEST(MATH_TEST, lrint) {
890   auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
891 
892   fesetround(FE_UPWARD); // lrint/lrintf/lrintl obey the rounding mode.
893   ASSERT_EQ(1235, lrint(1234.01));
894   ASSERT_EQ(1235, lrintf(1234.01f));
895   ASSERT_EQ(1235, lrintl(1234.01L));
896   fesetround(FE_TOWARDZERO); // lrint/lrintf/lrintl obey the rounding mode.
897   ASSERT_EQ(1234, lrint(1234.01));
898   ASSERT_EQ(1234, lrintf(1234.01f));
899   ASSERT_EQ(1234, lrintl(1234.01L));
900 
901   fesetround(FE_UPWARD); // llrint/llrintf/llrintl obey the rounding mode.
902   ASSERT_EQ(1235L, llrint(1234.01));
903   ASSERT_EQ(1235L, llrintf(1234.01f));
904   ASSERT_EQ(1235L, llrintl(1234.01L));
905   fesetround(FE_TOWARDZERO); // llrint/llrintf/llrintl obey the rounding mode.
906   ASSERT_EQ(1234L, llrint(1234.01));
907   ASSERT_EQ(1234L, llrintf(1234.01f));
908   ASSERT_EQ(1234L, llrintl(1234.01L));
909 }
910 
TEST(MATH_TEST,rint)911 TEST(MATH_TEST, rint) {
912   auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
913 
914   fesetround(FE_UPWARD); // rint/rintf/rintl obey the rounding mode.
915   feclearexcept(FE_ALL_EXCEPT); // rint/rintf/rintl do set the FE_INEXACT flag.
916   ASSERT_EQ(1234.0, rint(1234.0));
917   ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
918   ASSERT_EQ(1235.0, rint(1234.01));
919   ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) != 0);
920 
921   feclearexcept(FE_ALL_EXCEPT); // rint/rintf/rintl do set the FE_INEXACT flag.
922   ASSERT_EQ(1234.0f, rintf(1234.0f));
923   ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
924   ASSERT_EQ(1235.0f, rintf(1234.01f));
925   ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) != 0);
926 
927   feclearexcept(FE_ALL_EXCEPT); // rint/rintf/rintl do set the FE_INEXACT flag.
928   ASSERT_EQ(1234.0, rintl(1234.0L));
929   ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
930   ASSERT_EQ(1235.0, rintl(1234.01L));
931   ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) != 0);
932 
933   fesetround(FE_TOWARDZERO); // rint/rintf obey the rounding mode.
934   ASSERT_EQ(1234.0, rint(1234.01));
935   ASSERT_EQ(1234.0f, rintf(1234.01f));
936   ASSERT_EQ(1234.0, rintl(1234.01L));
937 }
938 
TEST(MATH_TEST,nearbyint)939 TEST(MATH_TEST, nearbyint) {
940   auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
941   fesetround(FE_UPWARD); // nearbyint/nearbyintf/nearbyintl obey the rounding mode.
942   feclearexcept(FE_ALL_EXCEPT); // nearbyint/nearbyintf/nearbyintl don't set the FE_INEXACT flag.
943   ASSERT_EQ(1234.0, nearbyint(1234.0));
944   ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
945   ASSERT_EQ(1235.0, nearbyint(1234.01));
946   ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
947 
948   feclearexcept(FE_ALL_EXCEPT);
949   ASSERT_EQ(1234.0f, nearbyintf(1234.0f));
950   ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
951   ASSERT_EQ(1235.0f, nearbyintf(1234.01f));
952   ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
953 
954   feclearexcept(FE_ALL_EXCEPT); // nearbyint/nearbyintf/nearbyintl don't set the FE_INEXACT flag.
955   ASSERT_EQ(1234.0, nearbyintl(1234.0L));
956   ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
957   ASSERT_EQ(1235.0, nearbyintl(1234.01L));
958   ASSERT_TRUE((fetestexcept(FE_ALL_EXCEPT) & FE_INEXACT) == 0);
959 
960   fesetround(FE_TOWARDZERO); // nearbyint/nearbyintf/nearbyintl obey the rounding mode.
961   ASSERT_EQ(1234.0, nearbyint(1234.01));
962   ASSERT_EQ(1234.0f, nearbyintf(1234.01f));
963   ASSERT_EQ(1234.0, nearbyintl(1234.01L));
964 }
965 
TEST(MATH_TEST,lround)966 TEST(MATH_TEST, lround) {
967   auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
968   fesetround(FE_UPWARD); // lround ignores the rounding mode.
969   ASSERT_EQ(1234, lround(1234.01));
970   ASSERT_EQ(1234, lroundf(1234.01f));
971   ASSERT_EQ(1234, lroundl(1234.01L));
972 }
973 
TEST(MATH_TEST,llround)974 TEST(MATH_TEST, llround) {
975   auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
976   fesetround(FE_UPWARD); // llround ignores the rounding mode.
977   ASSERT_EQ(1234L, llround(1234.01));
978   ASSERT_EQ(1234L, llroundf(1234.01f));
979   ASSERT_EQ(1234L, llroundl(1234.01L));
980 }
981 
TEST(MATH_TEST,ilogb)982 TEST(MATH_TEST, ilogb) {
983   ASSERT_EQ(FP_ILOGB0, ilogb(0.0));
984   ASSERT_EQ(FP_ILOGBNAN, ilogb(nan("")));
985   ASSERT_EQ(INT_MAX, ilogb(HUGE_VAL));
986   ASSERT_EQ(0, ilogb(1.0));
987   ASSERT_EQ(3, ilogb(10.0));
988 }
989 
TEST(MATH_TEST,ilogbf)990 TEST(MATH_TEST, ilogbf) {
991   ASSERT_EQ(FP_ILOGB0, ilogbf(0.0f));
992   ASSERT_EQ(FP_ILOGBNAN, ilogbf(nanf("")));
993   ASSERT_EQ(INT_MAX, ilogbf(HUGE_VALF));
994   ASSERT_EQ(0, ilogbf(1.0f));
995   ASSERT_EQ(3, ilogbf(10.0f));
996 }
997 
TEST(MATH_TEST,ilogbl)998 TEST(MATH_TEST, ilogbl) {
999   ASSERT_EQ(FP_ILOGB0, ilogbl(0.0L));
1000   ASSERT_EQ(FP_ILOGBNAN, ilogbl(nanl("")));
1001   ASSERT_EQ(INT_MAX, ilogbl(HUGE_VALL));
1002   ASSERT_EQ(0L, ilogbl(1.0L));
1003   ASSERT_EQ(3L, ilogbl(10.0L));
1004 }
1005 
TEST(MATH_TEST,logb)1006 TEST(MATH_TEST, logb) {
1007   ASSERT_EQ(-HUGE_VAL, logb(0.0));
1008   ASSERT_TRUE(isnan(logb(nan(""))));
1009   ASSERT_TRUE(isinf(logb(HUGE_VAL)));
1010   ASSERT_EQ(0.0, logb(1.0));
1011   ASSERT_EQ(3.0, logb(10.0));
1012 }
1013 
TEST(MATH_TEST,logbf)1014 TEST(MATH_TEST, logbf) {
1015   ASSERT_EQ(-HUGE_VALF, logbf(0.0f));
1016   ASSERT_TRUE(isnanf(logbf(nanf(""))));
1017   ASSERT_TRUE(isinff(logbf(HUGE_VALF)));
1018   ASSERT_EQ(0.0f, logbf(1.0f));
1019   ASSERT_EQ(3.0f, logbf(10.0f));
1020 }
1021 
TEST(MATH_TEST,logbl)1022 TEST(MATH_TEST, logbl) {
1023   ASSERT_EQ(-HUGE_VAL, logbl(0.0L));
1024   ASSERT_TRUE(isnan(logbl(nanl(""))));
1025   ASSERT_TRUE(isinf(logbl(HUGE_VALL)));
1026   ASSERT_EQ(0.0L, logbl(1.0L));
1027   ASSERT_EQ(3.0L, logbl(10.0L));
1028 }
1029 
TEST(MATH_TEST,log1p)1030 TEST(MATH_TEST, log1p) {
1031   ASSERT_EQ(-HUGE_VAL, log1p(-1.0));
1032   ASSERT_TRUE(isnan(log1p(nan(""))));
1033   ASSERT_TRUE(isinf(log1p(HUGE_VAL)));
1034   ASSERT_DOUBLE_EQ(1.0, log1p(M_E - 1.0));
1035 }
1036 
TEST(MATH_TEST,log1pf)1037 TEST(MATH_TEST, log1pf) {
1038   ASSERT_EQ(-HUGE_VALF, log1pf(-1.0f));
1039   ASSERT_TRUE(isnanf(log1pf(nanf(""))));
1040   ASSERT_TRUE(isinff(log1pf(HUGE_VALF)));
1041   ASSERT_FLOAT_EQ(1.0f, log1pf(static_cast<float>(M_E) - 1.0f));
1042 }
1043 
TEST(MATH_TEST,log1pl)1044 TEST(MATH_TEST, log1pl) {
1045   ASSERT_EQ(-HUGE_VALL, log1pl(-1.0L));
1046   ASSERT_TRUE(isnan(log1pl(nanl(""))));
1047   ASSERT_TRUE(isinf(log1pl(HUGE_VALL)));
1048   ASSERT_DOUBLE_EQ(1.0L, log1pl(M_E - 1.0L));
1049 }
1050 
TEST(MATH_TEST,fdim)1051 TEST(MATH_TEST, fdim) {
1052   ASSERT_DOUBLE_EQ(0.0, fdim(1.0, 1.0));
1053   ASSERT_DOUBLE_EQ(1.0, fdim(2.0, 1.0));
1054   ASSERT_DOUBLE_EQ(0.0, fdim(1.0, 2.0));
1055 }
1056 
TEST(MATH_TEST,fdimf)1057 TEST(MATH_TEST, fdimf) {
1058   ASSERT_FLOAT_EQ(0.0f, fdimf(1.0f, 1.0f));
1059   ASSERT_FLOAT_EQ(1.0f, fdimf(2.0f, 1.0f));
1060   ASSERT_FLOAT_EQ(0.0f, fdimf(1.0f, 2.0f));
1061 }
1062 
TEST(MATH_TEST,fdiml)1063 TEST(MATH_TEST, fdiml) {
1064   ASSERT_DOUBLE_EQ(0.0L, fdiml(1.0L, 1.0L));
1065   ASSERT_DOUBLE_EQ(1.0L, fdiml(2.0L, 1.0L));
1066   ASSERT_DOUBLE_EQ(0.0L, fdiml(1.0L, 2.0L));
1067 }
1068 
TEST(MATH_TEST,round)1069 TEST(MATH_TEST, round) {
1070   auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
1071   fesetround(FE_TOWARDZERO); // round ignores the rounding mode and always rounds away from zero.
1072   ASSERT_DOUBLE_EQ(1.0, round(0.5));
1073   ASSERT_DOUBLE_EQ(-1.0, round(-0.5));
1074   ASSERT_DOUBLE_EQ(0.0, round(0.0));
1075   ASSERT_DOUBLE_EQ(-0.0, round(-0.0));
1076   ASSERT_TRUE(isnan(round(nan(""))));
1077   ASSERT_DOUBLE_EQ(HUGE_VAL, round(HUGE_VAL));
1078 }
1079 
TEST(MATH_TEST,roundf)1080 TEST(MATH_TEST, roundf) {
1081   auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
1082   fesetround(FE_TOWARDZERO); // roundf ignores the rounding mode and always rounds away from zero.
1083   ASSERT_FLOAT_EQ(1.0f, roundf(0.5f));
1084   ASSERT_FLOAT_EQ(-1.0f, roundf(-0.5f));
1085   ASSERT_FLOAT_EQ(0.0f, roundf(0.0f));
1086   ASSERT_FLOAT_EQ(-0.0f, roundf(-0.0f));
1087   ASSERT_TRUE(isnanf(roundf(nanf(""))));
1088   ASSERT_FLOAT_EQ(HUGE_VALF, roundf(HUGE_VALF));
1089 }
1090 
TEST(MATH_TEST,roundl)1091 TEST(MATH_TEST, roundl) {
1092   auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
1093   fesetround(FE_TOWARDZERO); // roundl ignores the rounding mode and always rounds away from zero.
1094   ASSERT_DOUBLE_EQ(1.0L, roundl(0.5L));
1095   ASSERT_DOUBLE_EQ(-1.0L, roundl(-0.5L));
1096   ASSERT_DOUBLE_EQ(0.0L, roundl(0.0L));
1097   ASSERT_DOUBLE_EQ(-0.0L, roundl(-0.0L));
1098   ASSERT_TRUE(isnan(roundl(nanl(""))));
1099   ASSERT_DOUBLE_EQ(HUGE_VALL, roundl(HUGE_VALL));
1100 }
1101 
TEST(MATH_TEST,trunc)1102 TEST(MATH_TEST, trunc) {
1103   auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
1104   fesetround(FE_UPWARD); // trunc ignores the rounding mode and always rounds toward zero.
1105   ASSERT_DOUBLE_EQ(1.0, trunc(1.5));
1106   ASSERT_DOUBLE_EQ(-1.0, trunc(-1.5));
1107   ASSERT_DOUBLE_EQ(0.0, trunc(0.0));
1108   ASSERT_DOUBLE_EQ(-0.0, trunc(-0.0));
1109   ASSERT_TRUE(isnan(trunc(nan(""))));
1110   ASSERT_DOUBLE_EQ(HUGE_VAL, trunc(HUGE_VAL));
1111 }
1112 
TEST(MATH_TEST,truncf)1113 TEST(MATH_TEST, truncf) {
1114   auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
1115   fesetround(FE_UPWARD); // truncf ignores the rounding mode and always rounds toward zero.
1116   ASSERT_FLOAT_EQ(1.0f, truncf(1.5f));
1117   ASSERT_FLOAT_EQ(-1.0f, truncf(-1.5f));
1118   ASSERT_FLOAT_EQ(0.0f, truncf(0.0f));
1119   ASSERT_FLOAT_EQ(-0.0f, truncf(-0.0f));
1120   ASSERT_TRUE(isnan(truncf(nanf(""))));
1121   ASSERT_FLOAT_EQ(HUGE_VALF, truncf(HUGE_VALF));
1122 }
1123 
TEST(MATH_TEST,truncl)1124 TEST(MATH_TEST, truncl) {
1125   auto guard = android::base::make_scope_guard([]() { fesetenv(FE_DFL_ENV); });
1126   fesetround(FE_UPWARD); // truncl ignores the rounding mode and always rounds toward zero.
1127   ASSERT_DOUBLE_EQ(1.0L, truncl(1.5L));
1128   ASSERT_DOUBLE_EQ(-1.0L, truncl(-1.5L));
1129   ASSERT_DOUBLE_EQ(0.0L, truncl(0.0L));
1130   ASSERT_DOUBLE_EQ(-0.0L, truncl(-0.0L));
1131   ASSERT_TRUE(isnan(truncl(nan(""))));
1132   ASSERT_DOUBLE_EQ(HUGE_VALL, truncl(HUGE_VALL));
1133 }
1134 
TEST(MATH_TEST,nextafter)1135 TEST(MATH_TEST, nextafter) {
1136   ASSERT_DOUBLE_EQ(0.0, nextafter(0.0, 0.0));
1137   ASSERT_DOUBLE_EQ(4.9406564584124654e-324, nextafter(0.0, 1.0));
1138   ASSERT_DOUBLE_EQ(-4.9406564584124654e-324, nextafter(0.0, -1.0));
1139 }
1140 
TEST(MATH_TEST,nextafterf)1141 TEST(MATH_TEST, nextafterf) {
1142   ASSERT_FLOAT_EQ(0.0f, nextafterf(0.0f, 0.0f));
1143   ASSERT_FLOAT_EQ(1.4012985e-45f, nextafterf(0.0f, 1.0f));
1144   ASSERT_FLOAT_EQ(-1.4012985e-45f, nextafterf(0.0f, -1.0f));
1145 }
1146 
TEST(MATH_TEST,nextafterl)1147 TEST(MATH_TEST, nextafterl) {
1148   ASSERT_DOUBLE_EQ(0.0L, nextafterl(0.0L, 0.0L));
1149   // Use a runtime value to accomodate the case when
1150   // sizeof(double) == sizeof(long double)
1151   long double smallest_positive = ldexpl(1.0L, LDBL_MIN_EXP - LDBL_MANT_DIG);
1152   ASSERT_DOUBLE_EQ(smallest_positive, nextafterl(0.0L, 1.0L));
1153   ASSERT_DOUBLE_EQ(-smallest_positive, nextafterl(0.0L, -1.0L));
1154 }
1155 
TEST(MATH_TEST,nexttoward)1156 TEST(MATH_TEST, nexttoward) {
1157   ASSERT_DOUBLE_EQ(0.0, nexttoward(0.0, 0.0L));
1158   ASSERT_DOUBLE_EQ(4.9406564584124654e-324, nexttoward(0.0, 1.0L));
1159   ASSERT_DOUBLE_EQ(-4.9406564584124654e-324, nexttoward(0.0, -1.0L));
1160 }
1161 
TEST(MATH_TEST,nexttowardf)1162 TEST(MATH_TEST, nexttowardf) {
1163   ASSERT_FLOAT_EQ(0.0f, nexttowardf(0.0f, 0.0L));
1164   ASSERT_FLOAT_EQ(1.4012985e-45f, nexttowardf(0.0f, 1.0L));
1165   ASSERT_FLOAT_EQ(-1.4012985e-45f, nexttowardf(0.0f, -1.0L));
1166 }
1167 
TEST(MATH_TEST,nexttowardl)1168 TEST(MATH_TEST, nexttowardl) {
1169   ASSERT_DOUBLE_EQ(0.0L, nexttowardl(0.0L, 0.0L));
1170   // Use a runtime value to accomodate the case when
1171   // sizeof(double) == sizeof(long double)
1172   long double smallest_positive = ldexpl(1.0L, LDBL_MIN_EXP - LDBL_MANT_DIG);
1173   ASSERT_DOUBLE_EQ(smallest_positive, nexttowardl(0.0L, 1.0L));
1174   ASSERT_DOUBLE_EQ(-smallest_positive, nexttowardl(0.0L, -1.0L));
1175 }
1176 
TEST(MATH_TEST,copysign)1177 TEST(MATH_TEST, copysign) {
1178   ASSERT_DOUBLE_EQ(0.0, copysign(0.0, 1.0));
1179   ASSERT_DOUBLE_EQ(-0.0, copysign(0.0, -1.0));
1180   ASSERT_DOUBLE_EQ(2.0, copysign(2.0, 1.0));
1181   ASSERT_DOUBLE_EQ(-2.0, copysign(2.0, -1.0));
1182 }
1183 
TEST(MATH_TEST,copysignf)1184 TEST(MATH_TEST, copysignf) {
1185   ASSERT_FLOAT_EQ(0.0f, copysignf(0.0f, 1.0f));
1186   ASSERT_FLOAT_EQ(-0.0f, copysignf(0.0f, -1.0f));
1187   ASSERT_FLOAT_EQ(2.0f, copysignf(2.0f, 1.0f));
1188   ASSERT_FLOAT_EQ(-2.0f, copysignf(2.0f, -1.0f));
1189 }
1190 
TEST(MATH_TEST,copysignl)1191 TEST(MATH_TEST, copysignl) {
1192   ASSERT_DOUBLE_EQ(0.0L, copysignl(0.0L, 1.0L));
1193   ASSERT_DOUBLE_EQ(-0.0L, copysignl(0.0L, -1.0L));
1194   ASSERT_DOUBLE_EQ(2.0L, copysignl(2.0L, 1.0L));
1195   ASSERT_DOUBLE_EQ(-2.0L, copysignl(2.0L, -1.0L));
1196 }
1197 
TEST(MATH_TEST,significand)1198 TEST(MATH_TEST, significand) {
1199   ASSERT_DOUBLE_EQ(0.0, significand(0.0));
1200   ASSERT_DOUBLE_EQ(1.2, significand(1.2));
1201   ASSERT_DOUBLE_EQ(1.53125, significand(12.25));
1202 }
1203 
TEST(MATH_TEST,significandf)1204 TEST(MATH_TEST, significandf) {
1205   ASSERT_FLOAT_EQ(0.0f, significandf(0.0f));
1206   ASSERT_FLOAT_EQ(1.2f, significandf(1.2f));
1207   ASSERT_FLOAT_EQ(1.53125f, significandf(12.25f));
1208 }
1209 
TEST(MATH_TEST,significandl)1210 TEST(MATH_TEST, significandl) {
1211   ASSERT_DOUBLE_EQ(0.0L, significandl(0.0L));
1212   ASSERT_DOUBLE_EQ(1.2L, significandl(1.2L));
1213   ASSERT_DOUBLE_EQ(1.53125L, significandl(12.25L));
1214 }
1215 
TEST(MATH_TEST,scalb)1216 TEST(MATH_TEST, scalb) {
1217   ASSERT_DOUBLE_EQ(12.0, scalb(3.0, 2.0));
1218 }
1219 
TEST(MATH_TEST,scalbf)1220 TEST(MATH_TEST, scalbf) {
1221   ASSERT_FLOAT_EQ(12.0f, scalbf(3.0f, 2.0f));
1222 }
1223 
TEST(MATH_TEST,scalbln)1224 TEST(MATH_TEST, scalbln) {
1225   ASSERT_DOUBLE_EQ(12.0, scalbln(3.0, 2L));
1226 }
1227 
TEST(MATH_TEST,scalblnf)1228 TEST(MATH_TEST, scalblnf) {
1229   ASSERT_FLOAT_EQ(12.0f, scalblnf(3.0f, 2L));
1230 }
1231 
TEST(MATH_TEST,scalblnl)1232 TEST(MATH_TEST, scalblnl) {
1233   ASSERT_DOUBLE_EQ(12.0L, scalblnl(3.0L, 2L));
1234 }
1235 
TEST(MATH_TEST,scalbn)1236 TEST(MATH_TEST, scalbn) {
1237   ASSERT_DOUBLE_EQ(12.0, scalbn(3.0, 2));
1238 }
1239 
TEST(MATH_TEST,scalbnf)1240 TEST(MATH_TEST, scalbnf) {
1241   ASSERT_FLOAT_EQ(12.0f, scalbnf(3.0f, 2));
1242 }
1243 
TEST(MATH_TEST,scalbnl)1244 TEST(MATH_TEST, scalbnl) {
1245   ASSERT_DOUBLE_EQ(12.0L, scalbnl(3.0L, 2));
1246 }
1247 
TEST(MATH_TEST,gamma)1248 TEST(MATH_TEST, gamma) {
1249   ASSERT_DOUBLE_EQ(log(24.0), gamma(5.0));
1250 }
1251 
TEST(MATH_TEST,gammaf)1252 TEST(MATH_TEST, gammaf) {
1253   ASSERT_FLOAT_EQ(logf(24.0f), gammaf(5.0f));
1254 }
1255 
TEST(MATH_TEST,gamma_r)1256 TEST(MATH_TEST, gamma_r) {
1257 #if defined(__BIONIC__)
1258   int sign;
1259   ASSERT_DOUBLE_EQ(log(24.0), gamma_r(5.0, &sign));
1260   ASSERT_EQ(1, sign);
1261 #else // __BIONIC__
1262   GTEST_LOG_(INFO) << "glibc doesn't have gamma_r.\n";
1263 #endif // __BIONIC__
1264 }
1265 
TEST(MATH_TEST,gammaf_r)1266 TEST(MATH_TEST, gammaf_r) {
1267 #if defined(__BIONIC__)
1268   int sign;
1269   ASSERT_FLOAT_EQ(logf(24.0f), gammaf_r(5.0f, &sign));
1270   ASSERT_EQ(1, sign);
1271 #else // __BIONIC__
1272   GTEST_LOG_(INFO) << "glibc doesn't have gammaf_r.\n";
1273 #endif // __BIONIC__
1274 }
1275 
TEST(MATH_TEST,lgamma)1276 TEST(MATH_TEST, lgamma) {
1277   ASSERT_DOUBLE_EQ(log(24.0), lgamma(5.0));
1278 }
1279 
TEST(MATH_TEST,lgammaf)1280 TEST(MATH_TEST, lgammaf) {
1281   ASSERT_FLOAT_EQ(logf(24.0f), lgammaf(5.0f));
1282 }
1283 
TEST(MATH_TEST,lgammal)1284 TEST(MATH_TEST, lgammal) {
1285   ASSERT_DOUBLE_EQ(logl(24.0L), lgammal(5.0L));
1286 }
1287 
TEST(MATH_TEST,lgamma_r)1288 TEST(MATH_TEST, lgamma_r) {
1289   int sign;
1290   ASSERT_DOUBLE_EQ(log(24.0), lgamma_r(5.0, &sign));
1291   ASSERT_EQ(1, sign);
1292 }
1293 
TEST(MATH_TEST,lgamma_r_17471883)1294 TEST(MATH_TEST, lgamma_r_17471883) {
1295   int sign;
1296 
1297   sign = 0;
1298   ASSERT_DOUBLE_EQ(HUGE_VAL, lgamma_r(0.0, &sign));
1299   ASSERT_EQ(1, sign);
1300   sign = 0;
1301   ASSERT_DOUBLE_EQ(HUGE_VAL, lgamma_r(-0.0, &sign));
1302   ASSERT_EQ(-1, sign);
1303 }
1304 
TEST(MATH_TEST,lgammaf_r)1305 TEST(MATH_TEST, lgammaf_r) {
1306   int sign;
1307   ASSERT_FLOAT_EQ(logf(24.0f), lgammaf_r(5.0f, &sign));
1308   ASSERT_EQ(1, sign);
1309 }
1310 
TEST(MATH_TEST,lgammaf_r_17471883)1311 TEST(MATH_TEST, lgammaf_r_17471883) {
1312   int sign;
1313 
1314   sign = 0;
1315   ASSERT_FLOAT_EQ(HUGE_VALF, lgammaf_r(0.0f, &sign));
1316   ASSERT_EQ(1, sign);
1317   sign = 0;
1318   ASSERT_FLOAT_EQ(HUGE_VALF, lgammaf_r(-0.0f, &sign));
1319   ASSERT_EQ(-1, sign);
1320 }
1321 
TEST(MATH_TEST,lgammal_r)1322 TEST(MATH_TEST, lgammal_r) {
1323   int sign;
1324   ASSERT_DOUBLE_EQ(log(24.0L), lgamma_r(5.0L, &sign));
1325   ASSERT_EQ(1, sign);
1326 }
1327 
TEST(MATH_TEST,lgammal_r_17471883)1328 TEST(MATH_TEST, lgammal_r_17471883) {
1329   int sign;
1330 
1331   sign = 0;
1332   ASSERT_DOUBLE_EQ(HUGE_VAL, lgammal_r(0.0L, &sign));
1333   ASSERT_EQ(1, sign);
1334   sign = 0;
1335   ASSERT_DOUBLE_EQ(HUGE_VAL, lgammal_r(-0.0L, &sign));
1336   ASSERT_EQ(-1, sign);
1337 }
1338 
TEST(MATH_TEST,tgamma)1339 TEST(MATH_TEST, tgamma) {
1340   ASSERT_DOUBLE_EQ(24.0, tgamma(5.0));
1341 }
1342 
TEST(MATH_TEST,tgammaf)1343 TEST(MATH_TEST, tgammaf) {
1344   ASSERT_FLOAT_EQ(24.0f, tgammaf(5.0f));
1345 }
1346 
TEST(MATH_TEST,tgammal)1347 TEST(MATH_TEST, tgammal) {
1348   ASSERT_DOUBLE_EQ(24.0L, tgammal(5.0L));
1349 }
1350 
TEST(MATH_TEST,j0)1351 TEST(MATH_TEST, j0) {
1352   ASSERT_DOUBLE_EQ(1.0, j0(0.0));
1353   ASSERT_DOUBLE_EQ(0.76519768655796661, j0(1.0));
1354 }
1355 
TEST(MATH_TEST,j0f)1356 TEST(MATH_TEST, j0f) {
1357   ASSERT_FLOAT_EQ(1.0f, j0f(0.0f));
1358   ASSERT_FLOAT_EQ(0.76519769f, j0f(1.0f));
1359 }
1360 
TEST(MATH_TEST,j1)1361 TEST(MATH_TEST, j1) {
1362   ASSERT_DOUBLE_EQ(0.0, j1(0.0));
1363   ASSERT_DOUBLE_EQ(0.44005058574493355, j1(1.0));
1364 }
1365 
TEST(MATH_TEST,j1f)1366 TEST(MATH_TEST, j1f) {
1367   ASSERT_FLOAT_EQ(0.0f, j1f(0.0f));
1368   ASSERT_FLOAT_EQ(0.44005057f, j1f(1.0f));
1369 }
1370 
TEST(MATH_TEST,jn)1371 TEST(MATH_TEST, jn) {
1372   ASSERT_DOUBLE_EQ(0.0, jn(4, 0.0));
1373   ASSERT_DOUBLE_EQ(0.0024766389641099553, jn(4, 1.0));
1374 }
1375 
TEST(MATH_TEST,jnf)1376 TEST(MATH_TEST, jnf) {
1377   ASSERT_FLOAT_EQ(0.0f, jnf(4, 0.0f));
1378   ASSERT_FLOAT_EQ(0.0024766389f, jnf(4, 1.0f));
1379 }
1380 
TEST(MATH_TEST,y0)1381 TEST(MATH_TEST, y0) {
1382   ASSERT_DOUBLE_EQ(-HUGE_VAL, y0(0.0));
1383   ASSERT_DOUBLE_EQ(0.08825696421567697, y0(1.0));
1384 }
1385 
TEST(MATH_TEST,y0f)1386 TEST(MATH_TEST, y0f) {
1387   ASSERT_FLOAT_EQ(-HUGE_VALF, y0f(0.0f));
1388   ASSERT_FLOAT_EQ(0.088256963f, y0f(1.0f));
1389 }
1390 
TEST(MATH_TEST,y1)1391 TEST(MATH_TEST, y1) {
1392   ASSERT_DOUBLE_EQ(-HUGE_VAL, y1(0.0));
1393   ASSERT_DOUBLE_EQ(-0.78121282130028868, y1(1.0));
1394 }
1395 
TEST(MATH_TEST,y1f)1396 TEST(MATH_TEST, y1f) {
1397   ASSERT_FLOAT_EQ(-HUGE_VALF, y1f(0.0f));
1398   ASSERT_FLOAT_EQ(-0.78121281f, y1f(1.0f));
1399 }
1400 
TEST(MATH_TEST,yn)1401 TEST(MATH_TEST, yn) {
1402   ASSERT_DOUBLE_EQ(-HUGE_VAL, yn(4, 0.0));
1403   ASSERT_DOUBLE_EQ(-33.278423028972114, yn(4, 1.0));
1404 }
1405 
TEST(MATH_TEST,ynf)1406 TEST(MATH_TEST, ynf) {
1407   ASSERT_FLOAT_EQ(-HUGE_VALF, ynf(4, 0.0f));
1408   ASSERT_FLOAT_EQ(-33.278423f, ynf(4, 1.0f));
1409 }
1410 
TEST(MATH_TEST,frexp)1411 TEST(MATH_TEST, frexp) {
1412   int exp;
1413   double dr = frexp(1024.0, &exp);
1414   ASSERT_DOUBLE_EQ(1024.0, scalbn(dr, exp));
1415 }
1416 
TEST(MATH_TEST,frexpf)1417 TEST(MATH_TEST, frexpf) {
1418   int exp;
1419   float fr = frexpf(1024.0f, &exp);
1420   ASSERT_FLOAT_EQ(1024.0f, scalbnf(fr, exp));
1421 }
1422 
TEST(MATH_TEST,frexpl)1423 TEST(MATH_TEST, frexpl) {
1424   int exp;
1425   long double ldr = frexpl(1024.0L, &exp);
1426   ASSERT_DOUBLE_EQ(1024.0L, scalbnl(ldr, exp));
1427 }
1428 
TEST(MATH_TEST,modf)1429 TEST(MATH_TEST, modf) {
1430   double di;
1431   double df = modf(123.75, &di);
1432   ASSERT_DOUBLE_EQ(123.0, di);
1433   ASSERT_DOUBLE_EQ(0.75, df);
1434 }
1435 
TEST(MATH_TEST,modff)1436 TEST(MATH_TEST, modff) {
1437   float fi;
1438   float ff = modff(123.75f, &fi);
1439   ASSERT_FLOAT_EQ(123.0f, fi);
1440   ASSERT_FLOAT_EQ(0.75f, ff);
1441 }
1442 
TEST(MATH_TEST,modfl)1443 TEST(MATH_TEST, modfl) {
1444   long double ldi;
1445   long double ldf = modfl(123.75L, &ldi);
1446   ASSERT_DOUBLE_EQ(123.0L, ldi);
1447   ASSERT_DOUBLE_EQ(0.75L, ldf);
1448 }
1449 
TEST(MATH_TEST,remquo)1450 TEST(MATH_TEST, remquo) {
1451   int q;
1452   double d = remquo(13.0, 4.0, &q);
1453   ASSERT_EQ(3, q);
1454   ASSERT_DOUBLE_EQ(1.0, d);
1455 }
1456 
TEST(MATH_TEST,remquof)1457 TEST(MATH_TEST, remquof) {
1458   int q;
1459   float f = remquof(13.0f, 4.0f, &q);
1460   ASSERT_EQ(3, q);
1461   ASSERT_FLOAT_EQ(1.0, f);
1462 }
1463 
TEST(MATH_TEST,remquol)1464 TEST(MATH_TEST, remquol) {
1465   int q;
1466   long double ld = remquol(13.0L, 4.0L, &q);
1467   ASSERT_DOUBLE_EQ(3L, q);
1468   ASSERT_DOUBLE_EQ(1.0L, ld);
1469 }
1470 
1471 // https://code.google.com/p/android/issues/detail?id=6697
TEST(MATH_TEST,frexpf_public_bug_6697)1472 TEST(MATH_TEST, frexpf_public_bug_6697) {
1473   int exp;
1474   float fr = frexpf(14.1f, &exp);
1475   ASSERT_FLOAT_EQ(14.1f, scalbnf(fr, exp));
1476 }
1477 
TEST(MATH_TEST,exp2_STRICT_ALIGN_OpenBSD_bug)1478 TEST(MATH_TEST, exp2_STRICT_ALIGN_OpenBSD_bug) {
1479   // OpenBSD/x86's libm had a bug here, but it was already fixed in FreeBSD:
1480   // http://svnweb.FreeBSD.org/base/head/lib/msun/src/math_private.h?revision=240827&view=markup
1481   ASSERT_DOUBLE_EQ(5.0, exp2(log2(5)));
1482   ASSERT_FLOAT_EQ(5.0f, exp2f(log2f(5)));
1483   ASSERT_DOUBLE_EQ(5.0L, exp2l(log2l(5)));
1484 }
1485 
TEST(MATH_TEST,nextafterl_OpenBSD_bug)1486 TEST(MATH_TEST, nextafterl_OpenBSD_bug) {
1487   // OpenBSD/x86's libm had a bug here.
1488   ASSERT_TRUE(nextafter(1.0, 0.0) - 1.0 < 0.0);
1489   ASSERT_TRUE(nextafterf(1.0f, 0.0f) - 1.0f < 0.0f);
1490   ASSERT_TRUE(nextafterl(1.0L, 0.0L) - 1.0L < 0.0L);
1491 }
1492 
1493 #include "math_data/acos_intel_data.h"
TEST(MATH_TEST,acos_intel)1494 TEST(MATH_TEST, acos_intel) {
1495   DoMathDataTest<1>(g_acos_intel_data, acos);
1496 }
1497 
1498 #include "math_data/acosf_intel_data.h"
TEST(MATH_TEST,acosf_intel)1499 TEST(MATH_TEST, acosf_intel) {
1500   DoMathDataTest<1>(g_acosf_intel_data, acosf);
1501 }
1502 
1503 #include "math_data/acosh_intel_data.h"
TEST(MATH_TEST,acosh_intel)1504 TEST(MATH_TEST, acosh_intel) {
1505   DoMathDataTest<2>(g_acosh_intel_data, acosh);
1506 }
1507 
1508 #include "math_data/acoshf_intel_data.h"
TEST(MATH_TEST,acoshf_intel)1509 TEST(MATH_TEST, acoshf_intel) {
1510   DoMathDataTest<2>(g_acoshf_intel_data, acoshf);
1511 }
1512 
1513 #include "math_data/asin_intel_data.h"
TEST(MATH_TEST,asin_intel)1514 TEST(MATH_TEST, asin_intel) {
1515   DoMathDataTest<1>(g_asin_intel_data, asin);
1516 }
1517 
1518 #include "math_data/asinf_intel_data.h"
TEST(MATH_TEST,asinf_intel)1519 TEST(MATH_TEST, asinf_intel) {
1520   DoMathDataTest<1>(g_asinf_intel_data, asinf);
1521 }
1522 
1523 #include "math_data/asinh_intel_data.h"
TEST(MATH_TEST,asinh_intel)1524 TEST(MATH_TEST, asinh_intel) {
1525   DoMathDataTest<2>(g_asinh_intel_data, asinh);
1526 }
1527 
1528 #include "math_data/asinhf_intel_data.h"
TEST(MATH_TEST,asinhf_intel)1529 TEST(MATH_TEST, asinhf_intel) {
1530   DoMathDataTest<2>(g_asinhf_intel_data, asinhf);
1531 }
1532 
1533 #include "math_data/atan2_intel_data.h"
TEST(MATH_TEST,atan2_intel)1534 TEST(MATH_TEST, atan2_intel) {
1535   DoMathDataTest<2>(g_atan2_intel_data, atan2);
1536 }
1537 
1538 #include "math_data/atan2f_intel_data.h"
TEST(MATH_TEST,atan2f_intel)1539 TEST(MATH_TEST, atan2f_intel) {
1540   DoMathDataTest<2>(g_atan2f_intel_data, atan2f);
1541 }
1542 
1543 #include "math_data/atan_intel_data.h"
TEST(MATH_TEST,atan_intel)1544 TEST(MATH_TEST, atan_intel) {
1545   DoMathDataTest<1>(g_atan_intel_data, atan);
1546 }
1547 
1548 #include "math_data/atanf_intel_data.h"
TEST(MATH_TEST,atanf_intel)1549 TEST(MATH_TEST, atanf_intel) {
1550   DoMathDataTest<1>(g_atanf_intel_data, atanf);
1551 }
1552 
1553 #include "math_data/atanh_intel_data.h"
TEST(MATH_TEST,atanh_intel)1554 TEST(MATH_TEST, atanh_intel) {
1555   DoMathDataTest<2>(g_atanh_intel_data, atanh);
1556 }
1557 
1558 #include "math_data/atanhf_intel_data.h"
TEST(MATH_TEST,atanhf_intel)1559 TEST(MATH_TEST, atanhf_intel) {
1560   DoMathDataTest<2>(g_atanhf_intel_data, atanhf);
1561 }
1562 
1563 #include "math_data/cbrt_intel_data.h"
TEST(MATH_TEST,cbrt_intel)1564 TEST(MATH_TEST, cbrt_intel) {
1565   DoMathDataTest<1>(g_cbrt_intel_data, cbrt);
1566 }
1567 
1568 #include "math_data/cbrtf_intel_data.h"
TEST(MATH_TEST,cbrtf_intel)1569 TEST(MATH_TEST, cbrtf_intel) {
1570   DoMathDataTest<1>(g_cbrtf_intel_data, cbrtf);
1571 }
1572 
1573 #include "math_data/ceil_intel_data.h"
TEST(MATH_TEST,ceil_intel)1574 TEST(MATH_TEST, ceil_intel) {
1575   DoMathDataTest<1>(g_ceil_intel_data, ceil);
1576 }
1577 
1578 #include "math_data/ceilf_intel_data.h"
TEST(MATH_TEST,ceilf_intel)1579 TEST(MATH_TEST, ceilf_intel) {
1580   DoMathDataTest<1>(g_ceilf_intel_data, ceilf);
1581 }
1582 
1583 #include "math_data/copysign_intel_data.h"
TEST(MATH_TEST,copysign_intel)1584 TEST(MATH_TEST, copysign_intel) {
1585   DoMathDataTest<1>(g_copysign_intel_data, copysign);
1586 }
1587 
1588 #include "math_data/copysignf_intel_data.h"
TEST(MATH_TEST,copysignf_intel)1589 TEST(MATH_TEST, copysignf_intel) {
1590   DoMathDataTest<1>(g_copysignf_intel_data, copysignf);
1591 }
1592 
1593 #include "math_data/cos_intel_data.h"
TEST(MATH_TEST,cos_intel)1594 TEST(MATH_TEST, cos_intel) {
1595   DoMathDataTest<1>(g_cos_intel_data, cos);
1596 }
1597 
1598 #include "math_data/cosf_intel_data.h"
TEST(MATH_TEST,cosf_intel)1599 TEST(MATH_TEST, cosf_intel) {
1600   DoMathDataTest<1>(g_cosf_intel_data, cosf);
1601 }
1602 
1603 #include "math_data/cosh_intel_data.h"
TEST(MATH_TEST,cosh_intel)1604 TEST(MATH_TEST, cosh_intel) {
1605   DoMathDataTest<2>(g_cosh_intel_data, cosh);
1606 }
1607 
1608 #include "math_data/coshf_intel_data.h"
TEST(MATH_TEST,coshf_intel)1609 TEST(MATH_TEST, coshf_intel) {
1610   DoMathDataTest<2>(g_coshf_intel_data, coshf);
1611 }
1612 
1613 #include "math_data/exp_intel_data.h"
TEST(MATH_TEST,exp_intel)1614 TEST(MATH_TEST, exp_intel) {
1615   DoMathDataTest<1>(g_exp_intel_data, exp);
1616 }
1617 
1618 #include "math_data/expf_intel_data.h"
TEST(MATH_TEST,expf_intel)1619 TEST(MATH_TEST, expf_intel) {
1620   DoMathDataTest<1>(g_expf_intel_data, expf);
1621 }
1622 
1623 #include "math_data/exp2_intel_data.h"
TEST(MATH_TEST,exp2_intel)1624 TEST(MATH_TEST, exp2_intel) {
1625   DoMathDataTest<1>(g_exp2_intel_data, exp2);
1626 }
1627 
1628 #include "math_data/exp2f_intel_data.h"
TEST(MATH_TEST,exp2f_intel)1629 TEST(MATH_TEST, exp2f_intel) {
1630   DoMathDataTest<1>(g_exp2f_intel_data, exp2f);
1631 }
1632 
1633 #include "math_data/expm1_intel_data.h"
TEST(MATH_TEST,expm1_intel)1634 TEST(MATH_TEST, expm1_intel) {
1635   DoMathDataTest<1>(g_expm1_intel_data, expm1);
1636 }
1637 
1638 #include "math_data/expm1f_intel_data.h"
TEST(MATH_TEST,expm1f_intel)1639 TEST(MATH_TEST, expm1f_intel) {
1640   DoMathDataTest<1>(g_expm1f_intel_data, expm1f);
1641 }
1642 
1643 #include "math_data/fabs_intel_data.h"
TEST(MATH_TEST,fabs_intel)1644 TEST(MATH_TEST, fabs_intel) {
1645   DoMathDataTest<1>(g_fabs_intel_data, fabs);
1646 }
1647 
1648 #include "math_data/fabsf_intel_data.h"
TEST(MATH_TEST,fabsf_intel)1649 TEST(MATH_TEST, fabsf_intel) {
1650   DoMathDataTest<1>(g_fabsf_intel_data, fabsf);
1651 }
1652 
1653 #include "math_data/fdim_intel_data.h"
TEST(MATH_TEST,fdim_intel)1654 TEST(MATH_TEST, fdim_intel) {
1655   DoMathDataTest<1>(g_fdim_intel_data, fdim);
1656 }
1657 
1658 #include "math_data/fdimf_intel_data.h"
TEST(MATH_TEST,fdimf_intel)1659 TEST(MATH_TEST, fdimf_intel) {
1660   DoMathDataTest<1>(g_fdimf_intel_data, fdimf);
1661 }
1662 
1663 #include "math_data/floor_intel_data.h"
TEST(MATH_TEST,floor_intel)1664 TEST(MATH_TEST, floor_intel) {
1665   DoMathDataTest<1>(g_floor_intel_data, floor);
1666 }
1667 
1668 #include "math_data/floorf_intel_data.h"
TEST(MATH_TEST,floorf_intel)1669 TEST(MATH_TEST, floorf_intel) {
1670   DoMathDataTest<1>(g_floorf_intel_data, floorf);
1671 }
1672 
1673 #include "math_data/fma_intel_data.h"
TEST(MATH_TEST,fma_intel)1674 TEST(MATH_TEST, fma_intel) {
1675   DoMathDataTest<1>(g_fma_intel_data, fma);
1676 }
1677 
1678 #include "math_data/fmaf_intel_data.h"
TEST(MATH_TEST,fmaf_intel)1679 TEST(MATH_TEST, fmaf_intel) {
1680   DoMathDataTest<1>(g_fmaf_intel_data, fmaf);
1681 }
1682 
1683 #include "math_data/fmax_intel_data.h"
TEST(MATH_TEST,fmax_intel)1684 TEST(MATH_TEST, fmax_intel) {
1685   DoMathDataTest<1>(g_fmax_intel_data, fmax);
1686 }
1687 
1688 #include "math_data/fmaxf_intel_data.h"
TEST(MATH_TEST,fmaxf_intel)1689 TEST(MATH_TEST, fmaxf_intel) {
1690   DoMathDataTest<1>(g_fmaxf_intel_data, fmaxf);
1691 }
1692 
1693 #include "math_data/fmin_intel_data.h"
TEST(MATH_TEST,fmin_intel)1694 TEST(MATH_TEST, fmin_intel) {
1695   DoMathDataTest<1>(g_fmin_intel_data, fmin);
1696 }
1697 
1698 #include "math_data/fminf_intel_data.h"
TEST(MATH_TEST,fminf_intel)1699 TEST(MATH_TEST, fminf_intel) {
1700   DoMathDataTest<1>(g_fminf_intel_data, fminf);
1701 }
1702 
1703 #include "math_data/fmod_intel_data.h"
TEST(MATH_TEST,fmod_intel)1704 TEST(MATH_TEST, fmod_intel) {
1705   DoMathDataTest<1>(g_fmod_intel_data, fmod);
1706 }
1707 
1708 #include "math_data/fmodf_intel_data.h"
TEST(MATH_TEST,fmodf_intel)1709 TEST(MATH_TEST, fmodf_intel) {
1710   DoMathDataTest<1>(g_fmodf_intel_data, fmodf);
1711 }
1712 
1713 #include "math_data/frexp_intel_data.h"
TEST(MATH_TEST,frexp_intel)1714 TEST(MATH_TEST, frexp_intel) {
1715   DoMathDataTest<1>(g_frexp_intel_data, frexp);
1716 }
1717 
1718 #include "math_data/frexpf_intel_data.h"
TEST(MATH_TEST,frexpf_intel)1719 TEST(MATH_TEST, frexpf_intel) {
1720   DoMathDataTest<1>(g_frexpf_intel_data, frexpf);
1721 }
1722 
1723 #include "math_data/hypot_intel_data.h"
TEST(MATH_TEST,hypot_intel)1724 TEST(MATH_TEST, hypot_intel) {
1725   DoMathDataTest<1>(g_hypot_intel_data, hypot);
1726 }
1727 
1728 #include "math_data/hypotf_intel_data.h"
TEST(MATH_TEST,hypotf_intel)1729 TEST(MATH_TEST, hypotf_intel) {
1730   DoMathDataTest<1>(g_hypotf_intel_data, hypotf);
1731 }
1732 
1733 #include "math_data/ilogb_intel_data.h"
TEST(MATH_TEST,ilogb_intel)1734 TEST(MATH_TEST, ilogb_intel) {
1735   DoMathDataTest<1>(g_ilogb_intel_data, ilogb);
1736 }
1737 
1738 #include "math_data/ilogbf_intel_data.h"
TEST(MATH_TEST,ilogbf_intel)1739 TEST(MATH_TEST, ilogbf_intel) {
1740   DoMathDataTest<1>(g_ilogbf_intel_data, ilogbf);
1741 }
1742 
1743 #include "math_data/ldexp_intel_data.h"
TEST(MATH_TEST,ldexp_intel)1744 TEST(MATH_TEST, ldexp_intel) {
1745   DoMathDataTest<1>(g_ldexp_intel_data, ldexp);
1746 }
1747 
1748 #include "math_data/ldexpf_intel_data.h"
TEST(MATH_TEST,ldexpf_intel)1749 TEST(MATH_TEST, ldexpf_intel) {
1750   DoMathDataTest<1>(g_ldexpf_intel_data, ldexpf);
1751 }
1752 
1753 #include "math_data/llrint_intel_data.h"
TEST(MATH_TEST,llrint_intel)1754 TEST(MATH_TEST, llrint_intel) {
1755   DoMathDataTest<1>(g_llrint_intel_data, llrint);
1756 }
1757 
1758 #include "math_data/llrintf_intel_data.h"
TEST(MATH_TEST,llrintf_intel)1759 TEST(MATH_TEST, llrintf_intel) {
1760   DoMathDataTest<1>(g_llrintf_intel_data, llrintf);
1761 }
1762 
1763 #include "math_data/log_intel_data.h"
TEST(MATH_TEST,log_intel)1764 TEST(MATH_TEST, log_intel) {
1765   DoMathDataTest<1>(g_log_intel_data, log);
1766 }
1767 
1768 #include "math_data/logf_intel_data.h"
TEST(MATH_TEST,logf_intel)1769 TEST(MATH_TEST, logf_intel) {
1770   DoMathDataTest<1>(g_logf_intel_data, logf);
1771 }
1772 
1773 #include "math_data/log10_intel_data.h"
TEST(MATH_TEST,log10_intel)1774 TEST(MATH_TEST, log10_intel) {
1775   DoMathDataTest<1>(g_log10_intel_data, log10);
1776 }
1777 
1778 #include "math_data/log10f_intel_data.h"
TEST(MATH_TEST,log10f_intel)1779 TEST(MATH_TEST, log10f_intel) {
1780   DoMathDataTest<1>(g_log10f_intel_data, log10f);
1781 }
1782 
1783 #include "math_data/log1p_intel_data.h"
TEST(MATH_TEST,log1p_intel)1784 TEST(MATH_TEST, log1p_intel) {
1785   DoMathDataTest<1>(g_log1p_intel_data, log1p);
1786 }
1787 
1788 #include "math_data/log1pf_intel_data.h"
TEST(MATH_TEST,log1pf_intel)1789 TEST(MATH_TEST, log1pf_intel) {
1790   DoMathDataTest<1>(g_log1pf_intel_data, log1pf);
1791 }
1792 
1793 #include "math_data/log2_intel_data.h"
TEST(MATH_TEST,log2_intel)1794 TEST(MATH_TEST, log2_intel) {
1795   DoMathDataTest<1>(g_log2_intel_data, log2);
1796 }
1797 
1798 #include "math_data/log2f_intel_data.h"
TEST(MATH_TEST,log2f_intel)1799 TEST(MATH_TEST, log2f_intel) {
1800   DoMathDataTest<1>(g_log2f_intel_data, log2f);
1801 }
1802 
1803 #include "math_data/logb_intel_data.h"
TEST(MATH_TEST,logb_intel)1804 TEST(MATH_TEST, logb_intel) {
1805   DoMathDataTest<1>(g_logb_intel_data, logb);
1806 }
1807 
1808 #include "math_data/logbf_intel_data.h"
TEST(MATH_TEST,logbf_intel)1809 TEST(MATH_TEST, logbf_intel) {
1810   DoMathDataTest<1>(g_logbf_intel_data, logbf);
1811 }
1812 
1813 #include "math_data/lrint_intel_data.h"
TEST(MATH_TEST,lrint_intel)1814 TEST(MATH_TEST, lrint_intel) {
1815   DoMathDataTest<1>(g_lrint_intel_data, lrint);
1816 }
1817 
1818 #include "math_data/lrintf_intel_data.h"
TEST(MATH_TEST,lrintf_intel)1819 TEST(MATH_TEST, lrintf_intel) {
1820   DoMathDataTest<1>(g_lrintf_intel_data, lrintf);
1821 }
1822 
1823 #include "math_data/modf_intel_data.h"
TEST(MATH_TEST,modf_intel)1824 TEST(MATH_TEST, modf_intel) {
1825   DoMathDataTest<1>(g_modf_intel_data, modf);
1826 }
1827 
1828 #include "math_data/modff_intel_data.h"
TEST(MATH_TEST,modff_intel)1829 TEST(MATH_TEST, modff_intel) {
1830   DoMathDataTest<1>(g_modff_intel_data, modff);
1831 }
1832 
1833 #include "math_data/nearbyint_intel_data.h"
TEST(MATH_TEST,nearbyint_intel)1834 TEST(MATH_TEST, nearbyint_intel) {
1835   DoMathDataTest<1>(g_nearbyint_intel_data, nearbyint);
1836 }
1837 
1838 #include "math_data/nearbyintf_intel_data.h"
TEST(MATH_TEST,nearbyintf_intel)1839 TEST(MATH_TEST, nearbyintf_intel) {
1840   DoMathDataTest<1>(g_nearbyintf_intel_data, nearbyintf);
1841 }
1842 
1843 #include "math_data/nextafter_intel_data.h"
TEST(MATH_TEST,nextafter_intel)1844 TEST(MATH_TEST, nextafter_intel) {
1845   DoMathDataTest<1>(g_nextafter_intel_data, nextafter);
1846 }
1847 
1848 #include "math_data/nextafterf_intel_data.h"
TEST(MATH_TEST,nextafterf_intel)1849 TEST(MATH_TEST, nextafterf_intel) {
1850   DoMathDataTest<1>(g_nextafterf_intel_data, nextafterf);
1851 }
1852 
1853 #include "math_data/pow_intel_data.h"
TEST(MATH_TEST,pow_intel)1854 TEST(MATH_TEST, pow_intel) {
1855   DoMathDataTest<1>(g_pow_intel_data, pow);
1856 }
1857 
1858 #include "math_data/powf_intel_data.h"
TEST(MATH_TEST,powf_intel)1859 TEST(MATH_TEST, powf_intel) {
1860   DoMathDataTest<1>(g_powf_intel_data, powf);
1861 }
1862 
1863 #include "math_data/remainder_intel_data.h"
TEST(MATH_TEST,remainder_intel)1864 TEST(MATH_TEST, remainder_intel) {
1865   DoMathDataTest<1>(g_remainder_intel_data, remainder);
1866 }
1867 
1868 #include "math_data/remainderf_intel_data.h"
TEST(MATH_TEST,remainderf_intel)1869 TEST(MATH_TEST, remainderf_intel) {
1870   DoMathDataTest<1>(g_remainderf_intel_data, remainderf);
1871 }
1872 
1873 #include "math_data/remquo_intel_data.h"
TEST(MATH_TEST,remquo_intel)1874 TEST(MATH_TEST, remquo_intel) {
1875   DoMathDataTest<1>(g_remquo_intel_data, remquo);
1876 }
1877 
1878 #include "math_data/remquof_intel_data.h"
TEST(MATH_TEST,remquof_intel)1879 TEST(MATH_TEST, remquof_intel) {
1880   DoMathDataTest<1>(g_remquof_intel_data, remquof);
1881 }
1882 
1883 #include "math_data/rint_intel_data.h"
TEST(MATH_TEST,rint_intel)1884 TEST(MATH_TEST, rint_intel) {
1885   DoMathDataTest<1>(g_rint_intel_data, rint);
1886 }
1887 
1888 #include "math_data/rintf_intel_data.h"
TEST(MATH_TEST,rintf_intel)1889 TEST(MATH_TEST, rintf_intel) {
1890   DoMathDataTest<1>(g_rintf_intel_data, rintf);
1891 }
1892 
1893 #include "math_data/round_intel_data.h"
TEST(MATH_TEST,round_intel)1894 TEST(MATH_TEST, round_intel) {
1895   DoMathDataTest<1>(g_round_intel_data, round);
1896 }
1897 
1898 #include "math_data/roundf_intel_data.h"
TEST(MATH_TEST,roundf_intel)1899 TEST(MATH_TEST, roundf_intel) {
1900   DoMathDataTest<1>(g_roundf_intel_data, roundf);
1901 }
1902 
1903 #include "math_data/scalb_intel_data.h"
TEST(MATH_TEST,scalb_intel)1904 TEST(MATH_TEST, scalb_intel) {
1905   DoMathDataTest<1>(g_scalb_intel_data, scalb);
1906 }
1907 
1908 #include "math_data/scalbf_intel_data.h"
TEST(MATH_TEST,scalbf_intel)1909 TEST(MATH_TEST, scalbf_intel) {
1910   DoMathDataTest<1>(g_scalbf_intel_data, scalbf);
1911 }
1912 
1913 #include "math_data/scalbn_intel_data.h"
TEST(MATH_TEST,scalbn_intel)1914 TEST(MATH_TEST, scalbn_intel) {
1915   DoMathDataTest<1>(g_scalbn_intel_data, scalbn);
1916 }
1917 
1918 #include "math_data/scalbnf_intel_data.h"
TEST(MATH_TEST,scalbnf_intel)1919 TEST(MATH_TEST, scalbnf_intel) {
1920   DoMathDataTest<1>(g_scalbnf_intel_data, scalbnf);
1921 }
1922 
1923 #include "math_data/significand_intel_data.h"
TEST(MATH_TEST,significand_intel)1924 TEST(MATH_TEST, significand_intel) {
1925   DoMathDataTest<1>(g_significand_intel_data, significand);
1926 }
1927 
1928 #include "math_data/significandf_intel_data.h"
TEST(MATH_TEST,significandf_intel)1929 TEST(MATH_TEST, significandf_intel) {
1930   DoMathDataTest<1>(g_significandf_intel_data, significandf);
1931 }
1932 
1933 #include "math_data/sin_intel_data.h"
TEST(MATH_TEST,sin_intel)1934 TEST(MATH_TEST, sin_intel) {
1935   DoMathDataTest<1>(g_sin_intel_data, sin);
1936 }
1937 
1938 #include "math_data/sinf_intel_data.h"
TEST(MATH_TEST,sinf_intel)1939 TEST(MATH_TEST, sinf_intel) {
1940   DoMathDataTest<1>(g_sinf_intel_data, sinf);
1941 }
1942 
1943 #include "math_data/sinh_intel_data.h"
TEST(MATH_TEST,sinh_intel)1944 TEST(MATH_TEST, sinh_intel) {
1945   DoMathDataTest<2>(g_sinh_intel_data, sinh);
1946 }
1947 
1948 #include "math_data/sinhf_intel_data.h"
TEST(MATH_TEST,sinhf_intel)1949 TEST(MATH_TEST, sinhf_intel) {
1950   DoMathDataTest<2>(g_sinhf_intel_data, sinhf);
1951 }
1952 
1953 #include "math_data/sincos_intel_data.h"
TEST(MATH_TEST,sincos_intel)1954 TEST(MATH_TEST, sincos_intel) {
1955   DoMathDataTest<1>(g_sincos_intel_data, sincos);
1956 }
1957 
1958 #include "math_data/sincosf_intel_data.h"
TEST(MATH_TEST,sincosf_intel)1959 TEST(MATH_TEST, sincosf_intel) {
1960   DoMathDataTest<1>(g_sincosf_intel_data, sincosf);
1961 }
1962 
1963 #include "math_data/sqrt_intel_data.h"
TEST(MATH_TEST,sqrt_intel)1964 TEST(MATH_TEST, sqrt_intel) {
1965   DoMathDataTest<1>(g_sqrt_intel_data, sqrt);
1966 }
1967 
1968 #include "math_data/sqrtf_intel_data.h"
TEST(MATH_TEST,sqrtf_intel)1969 TEST(MATH_TEST, sqrtf_intel) {
1970   DoMathDataTest<1>(g_sqrtf_intel_data, sqrtf);
1971 }
1972 
1973 #include "math_data/tan_intel_data.h"
TEST(MATH_TEST,tan_intel)1974 TEST(MATH_TEST, tan_intel) {
1975   DoMathDataTest<1>(g_tan_intel_data, tan);
1976 }
1977 
1978 #include "math_data/tanf_intel_data.h"
TEST(MATH_TEST,tanf_intel)1979 TEST(MATH_TEST, tanf_intel) {
1980   DoMathDataTest<1>(g_tanf_intel_data, tanf);
1981 }
1982 
1983 #include "math_data/tanh_intel_data.h"
TEST(MATH_TEST,tanh_intel)1984 TEST(MATH_TEST, tanh_intel) {
1985   DoMathDataTest<2>(g_tanh_intel_data, tanh);
1986 }
1987 
1988 #include "math_data/tanhf_intel_data.h"
TEST(MATH_TEST,tanhf_intel)1989 TEST(MATH_TEST, tanhf_intel) {
1990   DoMathDataTest<2>(g_tanhf_intel_data, tanhf);
1991 }
1992 
1993 #include "math_data/trunc_intel_data.h"
TEST(MATH_TEST,trunc_intel)1994 TEST(MATH_TEST, trunc_intel) {
1995   DoMathDataTest<1>(g_trunc_intel_data, trunc);
1996 }
1997 
1998 #include "math_data/truncf_intel_data.h"
TEST(MATH_TEST,truncf_intel)1999 TEST(MATH_TEST, truncf_intel) {
2000   DoMathDataTest<1>(g_truncf_intel_data, truncf);
2001 }
2002