ReactOS 0.4.16-dev-1638-g46c2a3c
tan.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Tests for tan
5 * COPYRIGHT: Copyright 2021 Timo Kreuzer <timo.kreuzer@reactos.org>
6 */
7
8#if !defined(_CRTBLD) && !defined(_M_IX86)
9#define _CRTBLD // we don't want inline tan!
10#endif
11#include "math_helpers.h"
12
13#ifdef _MSC_VER
14#pragma function(tan)
15#endif
16
17#if !defined(_M_IX86)
18#define HAS_TANF
19#elif (defined(TEST_UCRTBASE) || defined(TEST_STATIC_CRT))
20#define HAS_LIBM_SSE2
21#endif
22
23
24// These are expected to match exactly
26{
27 { 0x0000000000000000 /* 0.000000 */, 0x0000000000000000 /* 0.000000 */ },
28 { 0x8000000000000000 /* -0.000000 */, 0x8000000000000000 /* -0.000000 */ },
29 { 0x7ff0000000000000 /* 1.#INF00 */, 0xfff8000000000000 /* -1.#IND00 */ },
30 { 0x7ff0000000000001 /* 1.#SNAN0 */, 0x7ff8000000000001 /* 1.#QNAN0 */ },
31 { 0x7ff7ffffffffffff /* 1.#SNAN0 */, 0x7fffffffffffffff /* 1.#QNAN0 */ },
32 { 0x7ff8000000000000 /* 1.#QNAN0 */, 0x7ff8000000000000 /* 1.#QNAN0 */ },
33 { 0x7ff8000000000001 /* 1.#QNAN0 */, 0x7ff8000000000001 /* 1.#QNAN0 */ },
34 { 0x7fffffffffffffff /* 1.#QNAN0 */, 0x7fffffffffffffff /* 1.#QNAN0 */ },
35 { 0xfff0000000000000 /* -1.#INF00 */, 0xfff8000000000000 /* -1.#IND00 */ },
36 { 0xfff0000000000001 /* -1.#SNAN0 */, 0xfff8000000000001 /* -1.#QNAN0 */ },
37 { 0xfff7ffffffffffff /* -1.#SNAN0 */, 0xffffffffffffffff /* -1.#QNAN0 */ },
38 { 0xfff8000000000000 /* -1.#IND00 */, 0xfff8000000000000 /* -1.#IND00 */ },
39 { 0xfff8000000000001 /* -1.#QNAN0 */, 0xfff8000000000001 /* -1.#QNAN0 */ },
40 { 0xffffffffffffffff /* -1.#QNAN0 */, 0xffffffffffffffff /* -1.#QNAN0 */ },
41};
42
44{
45 for (int i = 0; i < _countof(s_tan_exact_tests); i++)
46 {
47 double x = u64_to_dbl(s_tan_exact_tests[i].x);
48 double z = tan(x);
50 }
51}
52
53// This table is autogenerated by `python gen_math_tests.py tan`
55{
56// { x, { y_rounded, y_difference } }
57#if !(defined(_M_IX86) && defined(TEST_MSVCRT))
58 { -0x1.921fb54442d18p+0, { -0x1.d02967c31cdb5p+53, 0x1.f3c72fe49aa2ap-3 }, 1 }, // tan(-1.5707963267948966) == -16331239353195369.756
59#endif
60 { -0x1.85a6ec9bbc564p+0, { -0x1.48292602db3dfp+4, -0x1.59080789054e6p-52 }, 1 }, // tan(-1.5220783119405832) == -20.510046015889994508
61 { -0x1.792e23f335dafp+0, { -0x1.4761710422f56p+3, 0x1.e3d55dad3df46p-52 }, 1 }, // tan(-1.4733602970862696) == -10.230644710616313666
62 { -0x1.6cb55b4aaf5fbp+0, { -0x1.b2c590c42b471p+2, -0x1.5d53989828de4p-52 }, 1 }, // tan(-1.4246422822319562) == -6.7933084407533085002
63 { -0x1.603c92a228e46p+0, { -0x1.4440b5bd4111cp+2, -0x1.abec5d54c2abap-52 }, 1 }, // tan(-1.3759242673776426) == -5.0664495800195052214
64 { -0x1.53c3c9f9a2692p+0, { -0x1.0184ebdc8b27dp+2, -0x1.211209852aafdp-52 }, 1 }, // tan(-1.3272062525233292) == -4.0237378743883003572
65 { -0x1.474b01511beddp+0, { -0x1.a959c7c899705p+1, 0x1.e16a925ce3d25p-54 }, 1 }, // tan(-1.2784882376690156) == -3.3230523805131063697
66 { -0x1.3ad238a895729p+0, { -0x1.68ac5e279dd0bp+1, -0x1.d4cdade9a4c1ep-54 }, 1 }, // tan(-1.2297702228147023) == -2.8177602475585722303
67 { -0x1.2e5970000ef74p+0, { -0x1.379ee31c647b3p+1, -0x1.5e9c8a91c43d2p-54 }, 1 }, // tan(-1.1810522079603887) == -2.4345363510737683882
68 { -0x1.21e0a757887c0p+0, { -0x1.10fa3b265671bp+1, -0x1.d629f0bf05f70p-53 }, 1 }, // tan(-1.1323341931060753) == -2.1326364457317035047
69 { -0x1.1567deaf0200bp+0, { -0x1.e33a2bc8b934bp+0, 0x1.d4ca996c14e19p-56 }, 1 }, // tan(-1.0836161782517617) == -1.8876063694999227506
70 { -0x1.08ef16067b857p+0, { -0x1.af12917d3b0e2p+0, 0x1.f2079bbcce4a5p-56 }, 1 }, // tan(-1.0348981633974483) == -1.6838770800341582309
71 { -0x1.f8ec9abbea145p-1, { -0x1.82d4f782a01c3p+0, 0x1.72f6a4728aa93p-54 }, 1 }, // tan(-0.9861801485431348) == -1.5110621160421124104
72 { -0x1.dffb096add1dcp-1, { -0x1.5ca9a9f08c147p+0, 0x1.db383b0ec94fbp-54 }, 1 }, // tan(-0.9374621336888214) == -1.3619638645432857817
73 { -0x1.c7097819d0273p-1, { -0x1.3b3f45fb0d102p+0, -0x1.b6d38abd7652cp-58 }, 1 }, // tan(-0.8887441188345079) == -1.2314342248837992837
74 { -0x1.ae17e6c8c330ap-1, { -0x1.1d9debf5bcdadp+0, 0x1.4c70a3c0c8823p-54 }, 1 }, // tan(-0.8400261039801944) == -1.115690944189604722
75 { -0x1.95265577b63a1p-1, { -0x1.030b3d77c014ep+0, 0x1.3667d9fcd7a86p-54 }, 1 }, // tan(-0.7913080891258809) == -1.011890260444562472
76 { -0x1.7c34c426a9438p-1, { -0x1.d5f079b0e6c4cp-1, 0x1.5688a6674ac98p-56 }, 1 }, // tan(-0.7425900742715674) == -0.91785030636254692302
77 { -0x1.634332d59c4cfp-1, { -0x1.a9ea6c741d9ebp-1, 0x1.f3c3e52eca656p-55 }, 1 }, // tan(-0.6938720594172539) == -0.83186663548877720764
78 { -0x1.4a51a1848f566p-1, { -0x1.8152f115f047fp-1, -0x1.9227d5686fc02p-56 }, 1 }, // tan(-0.6451540445629405) == -0.75258592026524686562
79 { -0x1.31601033825fdp-1, { -0x1.5b9b116956dd4p-1, -0x1.021da723d81edp-56 }, 1 }, // tan(-0.596436029708627) == -0.67891745005493443777
80 { -0x1.186e7ee275694p-1, { -0x1.384df6b48888ep-1, -0x1.c79d9269e0dfdp-56 }, 1 }, // tan(-0.5477180148543135) == -0.60996981576706035516
81 { -0x1.fef9db22d0e56p-2, { -0x1.170adce3a684cp-1, 0x1.155476f2da1afp-56 }, 1 }, // tan(-0.499) == -0.54500475195823970427
82 { -0x1.0000000000000p-1, { -0x1.17b4f5bf3474ap-1, -0x1.0c5e59201e209p-55 }, 1 }, // tan(-0.5) == -0.54630248984379051326
83 { -0x1.e8ba2e8ba2e8cp-2, { -0x1.08c7caac28aa4p-1, 0x1.28cd16180fba1p-55 }, 1 }, // tan(-0.4772727272727273) == -0.51714928962276870529
84 { -0x1.d1745d1745d18p-2, { -0x1.f466d6406bb86p-2, 0x1.9028ce89507bdp-56 }, 1 }, // tan(-0.4545454545454546) == -0.48867354171937225134
85 { -0x1.ba2e8ba2e8ba4p-2, { -0x1.d7e21b76dc1a9p-2, -0x1.819c73e1623a4p-63 }, 1 }, // tan(-0.4318181818181819) == -0.46082346833193327268
86 { -0x1.a2e8ba2e8ba30p-2, { -0x1.bbf4be4924d13p-2, 0x1.210bfe1eac791p-57 }, 1 }, // tan(-0.40909090909090917) == -0.43355080911096981804
87 { -0x1.8ba2e8ba2e8bcp-2, { -0x1.a092eb7d16791p-2, -0x1.17dd013191ce5p-57 }, 1 }, // tan(-0.38636363636363646) == -0.40681045485472917193
88 { -0x1.745d1745d1748p-2, { -0x1.85b18d5ff2a82p-2, 0x1.c73ccb0f5765fp-56 }, 1 }, // tan(-0.36363636363636376) == -0.38056012056464547407
89 { -0x1.5d1745d1745d4p-2, { -0x1.6b46381f7ab06p-2, 0x1.ef981da78f64dp-56 }, 1 }, // tan(-0.34090909090909105) == -0.35476005260595430779
90 { -0x1.45d1745d17460p-2, { -0x1.5147181f7a3e1p-2, -0x1.f38537f209091p-57 }, 1 }, // tan(-0.31818181818181834) == -0.32937276546596024018
91 { -0x1.2e8ba2e8ba2ecp-2, { -0x1.37aae2091da45p-2, -0x1.28d36d7bc8acfp-60 }, 1 }, // tan(-0.29545454545454564) == -0.3043628042281947842
92 { -0x1.1745d1745d178p-2, { -0x1.1e68c45a69fa8p-2, -0x1.3400e52091ac5p-56 }, 1 }, // tan(-0.27272727272727293) == -0.27969652940600521767
93 { -0x1.0000000000004p-2, { -0x1.05785a43c4c5ap-2, -0x1.47e7420a285bep-57 }, 1 }, // tan(-0.2500000000000002) == -0.25534192122103650303
94 { -0x1.d1745d1745d20p-3, { -0x1.d9a33f4fbd685p-3, 0x1.154219988e9c3p-57 }, 1 }, // tan(-0.22727272727272751) == -0.23126840078446177865
95 { -0x1.a2e8ba2e8ba38p-3, { -0x1.a8d9cc2f752f2p-3, 0x1.0dc2a8dcacd37p-57 }, 1 }, // tan(-0.2045454545454548) == -0.20744666595296439683
96 { -0x1.745d1745d1750p-3, { -0x1.788595522f833p-3, 0x1.48cb47f93cc67p-57 }, 1 }, // tan(-0.1818181818181821) == -0.18384853989658863302
97 { -0x1.45d1745d17468p-3, { -0x1.48985912bccaap-3, -0x1.9ba520513e51cp-57 }, 1 }, // tan(-0.1590909090909094) == -0.16044683063919269467
98 { -0x1.1745d1745d180p-3, { -0x1.19044864d16f4p-3, -0x1.c642f9fbf57f4p-57 }, 1 }, // tan(-0.1363636363636367) == -0.13721520002052724051
99 { -0x1.d1745d1745d30p-4, { -0x1.d377eca4ea002p-4, -0x1.1caa3d80e4684p-61 }, 1 }, // tan(-0.11363636363636398) == -0.11412804068697826647
100 { -0x1.745d1745d1760p-4, { -0x1.756490c3f31dbp-4, 0x1.b6724a0e4e6bfp-59 }, 1 }, // tan(-0.09090909090909127) == -0.091160359849886612809
101 { -0x1.1745d1745d190p-4, { -0x1.17b4cf79cc8d0p-4, -0x1.3bc015ade5d5cp-59 }, 1 }, // tan(-0.06818181818181857) == -0.068287668659454017125
102 { -0x1.745d1745d1780p-5, { -0x1.749ecbcd3dedbp-5, -0x1.14076fc22d284p-59 }, 1 }, // tan(-0.04545454545454586) == -0.045485876131292813301
103 { -0x1.745d1745d17c0p-6, { -0x1.746d81cc44785p-6, 0x1.e86df438a8135p-60 }, 1 }, // tan(-0.02272727272727315) == -0.022731186633854887507
104 { -0x1.0000000000000p-51, { -0x1.0000000000000p-51, -0x1.5555555555555p-155 }, 1 }, // tan(-4.440892098500626e-16) == -4.4408920985006261617e-16
105 { -0x1.0000000000000p-52, { -0x1.0000000000000p-52, -0x1.5555555555555p-158 }, 1 }, // tan(-2.220446049250313e-16) == -2.2204460492503130808e-16
106 { -0x1.5555555555556p-53, { -0x1.5555555555556p-53, -0x1.948b0fcd6e9e3p-160 }, 1 }, // tan(-1.4802973661668756e-16) == -1.4802973661668755516e-16
107 { -0x1.5555555555556p-54, { -0x1.5555555555556p-54, -0x1.948b0fcd6e9e3p-163 }, 1 }, // tan(-7.401486830834378e-17) == -7.4014868308343777579e-17
108 { 0x0.0p+0, { 0x0.0p+0, 0x0.0p+0 }, 1 }, // tan(0.0) == 0.0
109 { 0x1.5555555555554p-54, { 0x1.5555555555554p-54, 0x1.948b0fcd6e9dcp-163 }, 1 }, // tan(7.401486830834375e-17) == 7.4014868308343752927e-17
110 { 0x1.5555555555554p-53, { 0x1.5555555555554p-53, 0x1.948b0fcd6e9dcp-160 }, 1 }, // tan(1.480297366166875e-16) == 1.4802973661668750585e-16
111 { 0x1.0000000000000p-52, { 0x1.0000000000000p-52, 0x1.5555555555555p-158 }, 1 }, // tan(2.220446049250313e-16) == 2.2204460492503130808e-16
112 { 0x1.0000000000000p-51, { 0x1.0000000000000p-51, 0x1.5555555555555p-155 }, 1 }, // tan(4.440892098500626e-16) == 4.4408920985006261617e-16
113 { 0x1.745d1745d17c0p-6, { 0x1.746d81cc44785p-6, -0x1.e86df438a8135p-60 }, 1 }, // tan(0.02272727272727315) == 0.022731186633854887507
114 { 0x1.745d1745d1780p-5, { 0x1.749ecbcd3dedbp-5, 0x1.14076fc22d284p-59 }, 1 }, // tan(0.04545454545454586) == 0.045485876131292813301
115 { 0x1.1745d1745d190p-4, { 0x1.17b4cf79cc8d0p-4, 0x1.3bc015ade5d5cp-59 }, 1 }, // tan(0.06818181818181857) == 0.068287668659454017125
116 { 0x1.745d1745d1760p-4, { 0x1.756490c3f31dbp-4, -0x1.b6724a0e4e6bfp-59 }, 1 }, // tan(0.09090909090909127) == 0.091160359849886612809
117 { 0x1.d1745d1745d30p-4, { 0x1.d377eca4ea002p-4, 0x1.1caa3d80e4684p-61 }, 1 }, // tan(0.11363636363636398) == 0.11412804068697826647
118 { 0x1.1745d1745d180p-3, { 0x1.19044864d16f4p-3, 0x1.c642f9fbf57f4p-57 }, 1 }, // tan(0.1363636363636367) == 0.13721520002052724051
119 { 0x1.45d1745d17468p-3, { 0x1.48985912bccaap-3, 0x1.9ba520513e51cp-57 }, 1 }, // tan(0.1590909090909094) == 0.16044683063919269467
120 { 0x1.745d1745d1750p-3, { 0x1.788595522f833p-3, -0x1.48cb47f93cc67p-57 }, 1 }, // tan(0.1818181818181821) == 0.18384853989658863302
121 { 0x1.a2e8ba2e8ba38p-3, { 0x1.a8d9cc2f752f2p-3, -0x1.0dc2a8dcacd37p-57 }, 1 }, // tan(0.2045454545454548) == 0.20744666595296439683
122 { 0x1.d1745d1745d20p-3, { 0x1.d9a33f4fbd685p-3, -0x1.154219988e9c3p-57 }, 1 }, // tan(0.22727272727272751) == 0.23126840078446177865
123 { 0x1.0000000000004p-2, { 0x1.05785a43c4c5ap-2, 0x1.47e7420a285bep-57 }, 1 }, // tan(0.2500000000000002) == 0.25534192122103650303
124 { 0x1.1745d1745d178p-2, { 0x1.1e68c45a69fa8p-2, 0x1.3400e52091ac5p-56 }, 1 }, // tan(0.27272727272727293) == 0.27969652940600521767
125 { 0x1.2e8ba2e8ba2ecp-2, { 0x1.37aae2091da45p-2, 0x1.28d36d7bc8acfp-60 }, 1 }, // tan(0.29545454545454564) == 0.3043628042281947842
126 { 0x1.45d1745d17460p-2, { 0x1.5147181f7a3e1p-2, 0x1.f38537f209091p-57 }, 1 }, // tan(0.31818181818181834) == 0.32937276546596024018
127 { 0x1.5d1745d1745d4p-2, { 0x1.6b46381f7ab06p-2, -0x1.ef981da78f64dp-56 }, 1 }, // tan(0.34090909090909105) == 0.35476005260595430779
128 { 0x1.745d1745d1748p-2, { 0x1.85b18d5ff2a82p-2, -0x1.c73ccb0f5765fp-56 }, 1 }, // tan(0.36363636363636376) == 0.38056012056464547407
129 { 0x1.8ba2e8ba2e8bcp-2, { 0x1.a092eb7d16791p-2, 0x1.17dd013191ce5p-57 }, 1 }, // tan(0.38636363636363646) == 0.40681045485472917193
130 { 0x1.a2e8ba2e8ba30p-2, { 0x1.bbf4be4924d13p-2, -0x1.210bfe1eac791p-57 }, 1 }, // tan(0.40909090909090917) == 0.43355080911096981804
131 { 0x1.ba2e8ba2e8ba4p-2, { 0x1.d7e21b76dc1a9p-2, 0x1.819c73e1623a4p-63 }, 1 }, // tan(0.4318181818181819) == 0.46082346833193327268
132 { 0x1.d1745d1745d18p-2, { 0x1.f466d6406bb86p-2, -0x1.9028ce89507bdp-56 }, 1 }, // tan(0.4545454545454546) == 0.48867354171937225134
133 { 0x1.e8ba2e8ba2e8cp-2, { 0x1.08c7caac28aa4p-1, -0x1.28cd16180fba1p-55 }, 1 }, // tan(0.4772727272727273) == 0.51714928962276870529
134 { 0x1.0000000000000p-1, { 0x1.17b4f5bf3474ap-1, 0x1.0c5e59201e209p-55 }, 1 }, // tan(0.5) == 0.54630248984379051326
135 { 0x1.0083126e978d5p-1, { 0x1.185f3e353789ap-1, -0x1.1164e2f8dc326p-55 }, 1 }, // tan(0.501) == 0.5476016464197243897
136 { 0x1.1968b9587f770p-1, { 0x1.39a5b1895ef0fp-1, 0x1.69076f1898249p-55 }, 1 }, // tan(0.5496271057634043) == 0.61259226610079224346
137 { 0x1.324e60426760cp-1, { 0x1.5cf7a819e93efp-1, 0x1.c1f568456e356p-56 }, 1 }, // tan(0.5982542115268088) == 0.68157697025583088509
138 { 0x1.4b34072c4f4a7p-1, { 0x1.82b607606becfp-1, -0x1.3d8f67e5f35dfp-56 }, 1 }, // tan(0.6468813172902131) == 0.75529501964589394413
139 { 0x1.6419ae1637343p-1, { 0x1.ab55d25bca8e2p-1, 0x1.4bc370a5ac8f2p-57 }, 1 }, // tan(0.6955084230536176) == 0.83463914270876339085
140 { 0x1.7cff55001f1dep-1, { 0x1.d76639191a092p-1, 0x1.e083312b5f5f2p-55 }, 1 }, // tan(0.7441355288170219) == 0.92070177489678633678
141 { 0x1.95e4fbea0707ap-1, { 0x1.03cc7485ba1c0p+0, -0x1.ffd40f6f90912p-54 }, 1 }, // tan(0.7927626345804264) == 1.0148384882432849308
142 { 0x1.aecaa2d3eef15p-1, { 0x1.1e66d60e326d4p+0, -0x1.61a7ab456a939p-54 }, 1 }, // tan(0.8413897403438307) == 1.1187566551838487371
143 { 0x1.c7b049bdd6db0p-1, { 0x1.3c117f3d5196bp+0, -0x1.eaea7607b3a57p-54 }, 1 }, // tan(0.8900168461072351) == 1.2346419834808225514
144 { 0x1.e095f0a7bec4cp-1, { 0x1.5d8723ffe6398p+0, 0x1.b3677f868b65fp-55 }, 1 }, // tan(0.9386439518706395) == 1.3653433322672068801
145 { 0x1.f97b9791a6ae7p-1, { 0x1.83c0173e2d001p+0, -0x1.54207765ad0b9p-55 }, 1 }, // tan(0.9872710576340439) == 1.5146498228832571873
146 { 0x1.09309f3dc74c1p+0, { 0x1.b00e5a163e86fp+0, 0x1.36a110d4cecd5p-54 }, 1 }, // tan(1.0358981633974482) == 1.6877189926440470787
147 { 0x1.15a372b2bb40fp+0, { 0x1.e44a7f426cc8ap+0, 0x1.3733708d99df4p-55 }, 1 }, // tan(1.0845252691608527) == 1.8917617356462721805
148 { 0x1.22164627af35dp+0, { 0x1.118f3cd8a0a0ap+1, -0x1.4d890bd026cb3p-53 }, 1 }, // tan(1.1331523749242571) == 2.1371837671042655745
149 { 0x1.2e89199ca32abp+0, { 0x1.384442285e0a4p+1, 0x1.e023f3b8735f6p-55 }, 1 }, // tan(1.1817794806876616) == 2.4395830819231197305
150 { 0x1.3afbed11971f8p+0, { 0x1.69671e3a41aecp+1, 0x1.521a4291c1306p-54 }, 1 }, // tan(1.2304065864510658) == 2.8234594139533922453
151 { 0x1.476ec0868b146p+0, { 0x1.aa316a5fb43c9p+1, -0x1.52dbeccfa5e16p-55 }, 1 }, // tan(1.2790336922144703) == 3.3296330420784880554
152 { 0x1.53e193fb7f094p+0, { 0x1.02052d9240193p+2, 0x1.f3c7273c87f91p-53 }, 1 }, // tan(1.3276607979778747) == 4.0315660408235942605
153 { 0x1.6054677072fe1p+0, { 0x1.44dfe447af0fdp+2, 0x1.9921e6edfc0f1p-53 }, 1 }, // tan(1.376287903741279) == 5.0761652660405591318
154 { 0x1.6cc73ae566f2fp+0, { 0x1.b398a2b7194e6p+2, -0x1.41da4eda108d7p-56 }, 1 }, // tan(1.4249150095046834) == 6.8061911380839088362
155 { 0x1.793a0e5a5ae7dp+0, { 0x1.47ff1e9ecf9bap+3, 0x1.858f5bd530970p-51 }, 1 }, // tan(1.4735421152680879) == 10.249892530610726703
156 { 0x1.85ace1cf4edcbp+0, { 0x1.48c674106788dp+4, -0x1.7df7c58540c45p-50 }, 1 }, // tan(1.5221692210314923) == 20.548450531081970734
157#if !(defined(_M_IX86) && defined(TEST_MSVCRT))
158 { 0x1.921fb54442d18p+0, { 0x1.d02967c31cdb5p+53, -0x1.f3c72fe49aa2ap-3 }, 1 }, // tan(1.5707963267948966) == 16331239353195369.756
159#endif
160 { 0x1.07eb3e0e397c5p+5, { -0x1.3e4f101260dc1p+8, -0x1.2b5a2b39a6a8bp-46 }, 1 }, // tan(32.989864455346414) == -318.30883898606051004
161 { 0x1.0e30855693b63p+5, { -0x1.fe64dee19cc97p-1, 0x1.77d5738519368p-55 }, 1 }, // tan(33.77369182241707) == -0.99686333183344085029
162#if !(defined(_M_IX86) && defined(TEST_MSVCRT))
163 { 0x1.1475cc9eedf01p+5, { 0x1.3ddc5bce200bbp-49, 0x1.15860679cd558p-103 }, 1 }, // tan(34.55751918948773) == 2.2056021997384124344e-15
164#endif
165 { 0x1.1abb13e74829ep+5, { 0x1.fe64dee19cc66p-1, 0x1.002beedbbd0f9p-55 }, 1 }, // tan(35.34134655655838) == 0.99686333183343547872
166 { 0x1.21005b2fa263cp+5, { 0x1.3e4f10125faffp+8, -0x1.2349bf9baab7cp-48 }, 1 }, // tan(36.125173923629035) == 318.30883898578752729
167};
168
170{
171 for (int i = 0; i < _countof(s_tan_approx_tests); i++)
172 {
173 double x = s_tan_approx_tests[i].x;
175 double z = tan(x);
177 ok(error <= s_tan_approx_tests[i].max_error,
178 "tan(%.17e) = %.17e, expected %.17e, error %I64d ULPs, max %u ULPs\n",
179 x, z, expected, error, s_tan_approx_tests[i].max_error);
180 }
181}
182
183#ifdef HAS_TANF
184
185// These are expected to match exactly
187{
188 { 0x00000000 /* 0.000000 */, 0x00000000 /* 0.000000 */ },
189 { 0x80000000 /* -0.000000 */, 0x00000000 /* 0.000000 */ },
190 { 0x7f800000 /* 1.#INF00 */, 0x00000000 /* 0.000000 */ },
191 { 0x7f800001 /* 1.#SNAN0 */, 0x00000000 /* 0.000000 */ },
192 { 0x7fBFffff /* 1.#SNAN0 */, 0x00000000 /* 0.000000 */ },
193 { 0x7fC00000 /* 1.#QNAN0 */, 0x00000000 /* 0.000000 */ },
194 { 0x7fC80001 /* 1.#QNAN0 */, 0x00000000 /* 0.000000 */ },
195 { 0x7fFfffff /* 1.#QNAN0 */, 0x00000000 /* 0.000000 */ },
196 { 0xff800000 /* -1.#INF00 */, 0x00000000 /* 0.000000 */ },
197 { 0xff800001 /* -1.#SNAN0 */, 0x00000000 /* 0.000000 */ },
198 { 0xffBfffff /* -1.#SNAN0 */, 0x00000000 /* 0.000000 */ },
199 { 0xffC00000 /* -1.#IND00 */, 0x00000000 /* 0.000000 */ },
200 { 0xfff80001 /* -1.#QNAN0 */, 0x00000000 /* 0.000000 */ },
201 { 0xffffffff /* -1.#QNAN0 */, 0x00000000 /* 0.000000 */ },
202};
203
205{
206 for (int i = 0; i < _countof(s_tanf_exact_tests); i++)
207 {
209 float z = tanf(x);
211 }
212}
213
214#endif // HAS_TANF
215
216#if defined(HAS_TANF) || defined(HAS_LIBM_SSE2)
217
219{
220// { x, { y_rounded, y_difference } }
221 { -0x1.921fb60000000p+0, { 0x1.5d14946dc9897p+24, 0x1.759086954a140p-30 }, 1 }, // tanf(-1.5707963705062866) == 22877332.428856459874
222 { -0x1.85a6ec0000000p+0, { -0x1.482915fa9ee30p+4, -0x1.bbeceea93d6b7p-50 }, 1 }, // tanf(-1.522078275680542) == -20.510030726420326749
223 { -0x1.792e240000000p+0, { -0x1.476171ad10b84p+3, -0x1.5815b396155f9p-51 }, 1 }, // tanf(-1.473360300064087) == -10.230645025270640389
224 { -0x1.6cb55c0000000p+0, { -0x1.b2c5991d60457p+2, 0x1.b292872ff2d76p-53 }, 1 }, // tanf(-1.4246423244476318) == -6.7933104311824397462
225 { -0x1.603c920000000p+0, { -0x1.4440b18419367p+2, -0x1.750eac0a12690p-55 }, 1 }, // tanf(-1.3759242296218872) == -5.0664485731148039398
226 { -0x1.53c3ca0000000p+0, { -0x1.0184ebf7e6818p+2, -0x1.1aebbc20cd7b5p-52 }, 1 }, // tanf(-1.3272062540054321) == -4.0237378998663404739
227 { -0x1.474b020000000p+0, { -0x1.a959cbe5ad45ep+1, -0x1.1f19c933c0298p-53 }, 1 }, // tanf(-1.278488278388977) == -3.3230528708905203851
228 { -0x1.3ad2380000000p+0, { -0x1.68ac5b3610f2ep+1, 0x1.ce3a53388d573p-53 }, 1 }, // tanf(-1.2297701835632324) == -2.8177598966593879964
229 { -0x1.2e59700000000p+0, { -0x1.379ee31c30a5cp+1, 0x1.7fd7a0966bccep-53 }, 1 }, // tanf(-1.1810522079467773) == -2.4345363509794831215
230 { -0x1.21e0a80000000p+0, { -0x1.10fa3cf9ad29bp+1, -0x1.18a3dc72f2dc1p-54 }, 1 }, // tanf(-1.1323342323303223) == -2.1326366633532650217
231 { -0x1.1567de0000000p+0, { -0x1.e33a28aa2717fp+0, 0x1.68562cb63425ep-54 }, 1 }, // tanf(-1.0836161375045776) == -1.8876061835681806951
232 { -0x1.08ef160000000p+0, { -0x1.af1291645e0ecp+0, -0x1.82c32a8763e67p-55 }, 1 }, // tanf(-1.0348981618881226) == -1.6838770742452267435
233 { -0x1.f8ec9a0000000p-1, { -0x1.82d4f64e228edp+0, 0x1.96d28d6d91903p-54 }, 1 }, // tanf(-0.9861801266670227) == -1.5110620442160850547
234 { -0x1.dffb0a0000000p-1, { -0x1.5ca9aac56f660p+0, -0x1.cf1198d68e402p-54 }, 1 }, // tanf(-0.9374621510505676) == -1.3619639141101275053
235 { -0x1.c709780000000p-1, { -0x1.3b3f45da9295cp+0, 0x1.63bd7d7c7576bp-54 }, 1 }, // tanf(-0.8887441158294678) == -1.2314342173218254867
236 { -0x1.ae17e60000000p-1, { -0x1.1d9deb1467c2fp+0, 0x1.d93dccaaa6e15p-55 }, 1 }, // tanf(-0.8400260806083679) == -1.11569089172531805
237 { -0x1.9526560000000p-1, { -0x1.030b3e01ab2b9p+0, 0x1.f0be43b2a457bp-54 }, 1 }, // tanf(-0.7913081049919128) == -1.0118902925561724693
238 { -0x1.7c34c40000000p-1, { -0x1.d5f07969ab903p-1, 0x1.d7d4d48e87fc3p-57 }, 1 }, // tanf(-0.742590069770813) == -0.91785029807013561563
239 { -0x1.6343320000000p-1, { -0x1.a9ea6b0aafabap-1, 0x1.85b16fcacb454p-56 }, 1 }, // tanf(-0.6938720345497131) == -0.83186659341284683419
240 { -0x1.4a51a20000000p-1, { -0x1.8152f1d74b1a8p-1, 0x1.dd7a25caf317ap-55 }, 1 }, // tanf(-0.6451540589332581) == -0.75258594277470520037
241 { -0x1.3160100000000p-1, { -0x1.5b9b111e16825p-1, -0x1.cd18dbc056bb1p-57 }, 1 }, // tanf(-0.5964360237121582) == -0.67891744129451993135
242 { -0x1.186e7e0000000p-1, { -0x1.384df57dd15a7p-1, -0x1.f2f27bdb30755p-55 }, 1 }, // tanf(-0.5477179884910583) == -0.60996977959500936342
243 { -0x1.fef9dc0000000p-2, { -0x1.170add731774cp-1, -0x1.b4799c456e9b6p-55 }, 1 }, // tanf(-0.49900001287460327) == -0.54500476865698881682
244 { -0x1.0000000000000p-1, { -0x1.17b4f5bf3474ap-1, -0x1.0c5e59201e209p-55 }, 1 }, // tanf(-0.5) == -0.54630248984379051326
245 { -0x1.e8ba2e0000000p-2, { -0x1.08c7ca53ab12cp-1, 0x1.f57d7c1223293p-58 }, 1 }, // tanf(-0.47727271914482117) == -0.51714927932110787298
246 { -0x1.d1745e0000000p-2, { -0x1.f466d760b947fp-2, -0x1.21b5240e6aa7ap-56 }, 1 }, // tanf(-0.4545454680919647) == -0.48867355850081391394
247 { -0x1.ba2e8c0000000p-2, { -0x1.d7e21be7b824ep-2, -0x1.280c597324109p-58 }, 1 }, // tanf(-0.4318181872367859) == -0.46082347490122266677
248 { -0x1.a2e8ba0000000p-2, { -0x1.bbf4be11d9713p-2, -0x1.1fd834abca2e6p-56 }, 1 }, // tanf(-0.40909090638160706) == -0.43355080589241020045
249 { -0x1.8ba2e80000000p-2, { -0x1.a092eaa41806cp-2, 0x1.7c80008b49c5bp-58 }, 1 }, // tanf(-0.3863636255264282) == -0.40681044222401995842
250 { -0x1.745d180000000p-2, { -0x1.85b18e3517fa5p-2, 0x1.4fde597478211p-58 }, 1 }, // tanf(-0.3636363744735718) == -0.38056013297136309192
251 { -0x1.5d17460000000p-2, { -0x1.6b463853e1f6ap-2, 0x1.3ea3b0f12ae57p-56 }, 1 }, // tanf(-0.34090909361839294) == -0.35476005565623456799
252 { -0x1.45d1740000000p-2, { -0x1.514717b849998p-2, 0x1.fd76e2939aa2bp-59 }, 1 }, // tanf(-0.3181818127632141) == -0.32937275945951105182
253 { -0x1.2e8ba20000000p-2, { -0x1.37aae10ad4551p-2, -0x1.f30aa8f232fc7p-60 }, 1 }, // tanf(-0.2954545319080353) == -0.30436278942678024642
254 { -0x1.1745d20000000p-2, { -0x1.1e68c4f0f95f7p-2, -0x1.1395a0da02fbap-58 }, 1 }, // tanf(-0.27272728085517883) == -0.27969653816975842782
255 { -0x1.0000000000000p-2, { -0x1.05785a43c4c56p-2, 0x1.9c6bfe7769a3dp-58 }, 1 }, // tanf(-0.25) == -0.2553419212210362665
256 { -0x1.d1745e0000000p-3, { -0x1.d9a34044ea216p-3, -0x1.fbfe898f560d7p-57 }, 1 }, // tanf(-0.22727273404598236) == -0.23126840791998466696
257 { -0x1.a2e8ba0000000p-3, { -0x1.a8d9cbfee8c43p-3, 0x1.858552a968917p-59 }, 1 }, // tanf(-0.20454545319080353) == -0.20744666454001689251
258 { -0x1.745d180000000p-3, { -0x1.78859612a9102p-3, 0x1.0b201e0d80102p-58 }, 1 }, // tanf(-0.1818181872367859) == -0.18384854549834278219
259 { -0x1.45d1740000000p-3, { -0x1.489858b34005fp-3, -0x1.6ada9662e24cfp-57 }, 1 }, // tanf(-0.15909090638160706) == -0.16044682786014428528
260 { -0x1.1745d20000000p-3, { -0x1.190448f315625p-3, -0x1.0c5ee14b4d884p-57 }, 1 }, // tanf(-0.13636364042758942) == -0.13721520416099611989
261 { -0x1.d1745e0000000p-4, { -0x1.d377ed90ac31dp-4, 0x1.8d56873a5ced9p-59 }, 1 }, // tanf(-0.11363636702299118) == -0.11412804411771699806
262 { -0x1.745d180000000p-4, { -0x1.7564917fadbdap-4, -0x1.1122d5adaf096p-59 }, 1 }, // tanf(-0.09090909361839294) == -0.091160362581703154502
263 { -0x1.1745d20000000p-4, { -0x1.17b4d00616260p-4, 0x1.d3629eb18cc93p-58 }, 1 }, // tanf(-0.06818182021379471) == -0.068287670700905683024
264 { -0x1.745d180000000p-5, { -0x1.749ecc87cf126p-5, -0x1.dcf4ecf92b84dp-59 }, 1 }, // tanf(-0.04545454680919647) == -0.045485877488746151899
265 { -0x1.745d180000000p-6, { -0x1.746d82868b9cfp-6, 0x1.2e64b511833eap-63 }, 1 }, // tanf(-0.022727273404598236) == -0.022731187311529950934
266 { -0x1.0000000000000p-51, { -0x1.0000000000000p-51, -0x1.5555555555555p-155 }, 1 }, // tanf(-4.440892098500626e-16) == -4.4408920985006261617e-16
267 { -0x1.0000000000000p-52, { -0x1.0000000000000p-52, -0x1.5555555555555p-158 }, 1 }, // tanf(-2.220446049250313e-16) == -2.2204460492503130808e-16
268 { -0x1.5555560000000p-53, { -0x1.5555560000000p-53, -0x1.948b122c3f36fp-160 }, 1 }, // tanf(-1.4802974102831747e-16) == -1.4802974102831747234e-16
269 { -0x1.5555560000000p-54, { -0x1.5555560000000p-54, -0x1.948b122c3f36fp-163 }, 1 }, // tanf(-7.401487051415874e-17) == -7.401487051415873617e-17
270 { 0x0.0p+0, { 0x0.0p+0, 0x0.0p+0 }, 1 }, // tanf(0.0) == 0.0
271 { 0x1.5555560000000p-54, { 0x1.5555560000000p-54, 0x1.948b122c3f36fp-163 }, 1 }, // tanf(7.401487051415874e-17) == 7.401487051415873617e-17
272 { 0x1.5555560000000p-53, { 0x1.5555560000000p-53, 0x1.948b122c3f36fp-160 }, 1 }, // tanf(1.4802974102831747e-16) == 1.4802974102831747234e-16
273 { 0x1.0000000000000p-52, { 0x1.0000000000000p-52, 0x1.5555555555555p-158 }, 1 }, // tanf(2.220446049250313e-16) == 2.2204460492503130808e-16
274 { 0x1.0000000000000p-51, { 0x1.0000000000000p-51, 0x1.5555555555555p-155 }, 1 }, // tanf(4.440892098500626e-16) == 4.4408920985006261617e-16
275 { 0x1.745d180000000p-6, { 0x1.746d82868b9cfp-6, -0x1.2e64b511833eap-63 }, 1 }, // tanf(0.022727273404598236) == 0.022731187311529950934
276 { 0x1.745d180000000p-5, { 0x1.749ecc87cf126p-5, 0x1.dcf4ecf92b84dp-59 }, 1 }, // tanf(0.04545454680919647) == 0.045485877488746151899
277 { 0x1.1745d20000000p-4, { 0x1.17b4d00616260p-4, -0x1.d3629eb18cc93p-58 }, 1 }, // tanf(0.06818182021379471) == 0.068287670700905683024
278 { 0x1.745d180000000p-4, { 0x1.7564917fadbdap-4, 0x1.1122d5adaf096p-59 }, 1 }, // tanf(0.09090909361839294) == 0.091160362581703154502
279 { 0x1.d1745e0000000p-4, { 0x1.d377ed90ac31dp-4, -0x1.8d56873a5ced9p-59 }, 1 }, // tanf(0.11363636702299118) == 0.11412804411771699806
280 { 0x1.1745d20000000p-3, { 0x1.190448f315625p-3, 0x1.0c5ee14b4d884p-57 }, 1 }, // tanf(0.13636364042758942) == 0.13721520416099611989
281 { 0x1.45d1740000000p-3, { 0x1.489858b34005fp-3, 0x1.6ada9662e24cfp-57 }, 1 }, // tanf(0.15909090638160706) == 0.16044682786014428528
282 { 0x1.745d180000000p-3, { 0x1.78859612a9102p-3, -0x1.0b201e0d80102p-58 }, 1 }, // tanf(0.1818181872367859) == 0.18384854549834278219
283 { 0x1.a2e8ba0000000p-3, { 0x1.a8d9cbfee8c43p-3, -0x1.858552a968917p-59 }, 1 }, // tanf(0.20454545319080353) == 0.20744666454001689251
284 { 0x1.d1745e0000000p-3, { 0x1.d9a34044ea216p-3, 0x1.fbfe898f560d7p-57 }, 1 }, // tanf(0.22727273404598236) == 0.23126840791998466696
285 { 0x1.0000000000000p-2, { 0x1.05785a43c4c56p-2, -0x1.9c6bfe7769a3dp-58 }, 1 }, // tanf(0.25) == 0.2553419212210362665
286 { 0x1.1745d20000000p-2, { 0x1.1e68c4f0f95f7p-2, 0x1.1395a0da02fbap-58 }, 1 }, // tanf(0.27272728085517883) == 0.27969653816975842782
287 { 0x1.2e8ba20000000p-2, { 0x1.37aae10ad4551p-2, 0x1.f30aa8f232fc7p-60 }, 1 }, // tanf(0.2954545319080353) == 0.30436278942678024642
288 { 0x1.45d1740000000p-2, { 0x1.514717b849998p-2, -0x1.fd76e2939aa2bp-59 }, 1 }, // tanf(0.3181818127632141) == 0.32937275945951105182
289 { 0x1.5d17460000000p-2, { 0x1.6b463853e1f6ap-2, -0x1.3ea3b0f12ae57p-56 }, 1 }, // tanf(0.34090909361839294) == 0.35476005565623456799
290 { 0x1.745d180000000p-2, { 0x1.85b18e3517fa5p-2, -0x1.4fde597478211p-58 }, 1 }, // tanf(0.3636363744735718) == 0.38056013297136309192
291 { 0x1.8ba2e80000000p-2, { 0x1.a092eaa41806cp-2, -0x1.7c80008b49c5bp-58 }, 1 }, // tanf(0.3863636255264282) == 0.40681044222401995842
292 { 0x1.a2e8ba0000000p-2, { 0x1.bbf4be11d9713p-2, 0x1.1fd834abca2e6p-56 }, 1 }, // tanf(0.40909090638160706) == 0.43355080589241020045
293 { 0x1.ba2e8c0000000p-2, { 0x1.d7e21be7b824ep-2, 0x1.280c597324109p-58 }, 1 }, // tanf(0.4318181872367859) == 0.46082347490122266677
294 { 0x1.d1745e0000000p-2, { 0x1.f466d760b947fp-2, 0x1.21b5240e6aa7ap-56 }, 1 }, // tanf(0.4545454680919647) == 0.48867355850081391394
295 { 0x1.e8ba2e0000000p-2, { 0x1.08c7ca53ab12cp-1, -0x1.f57d7c1223293p-58 }, 1 }, // tanf(0.47727271914482117) == 0.51714927932110787298
296 { 0x1.0000000000000p-1, { 0x1.17b4f5bf3474ap-1, 0x1.0c5e59201e209p-55 }, 1 }, // tanf(0.5) == 0.54630248984379051326
297 { 0x1.0083120000000p-1, { 0x1.185f3da576451p-1, -0x1.886f12969f560p-55 }, 1 }, // tanf(0.5009999871253967) == 0.54760162968444532536
298 { 0x1.1968ba0000000p-1, { 0x1.39a5b26fbb399p-1, 0x1.f18e65d72003dp-61 }, 1 }, // tanf(0.5496271252632141) == 0.61259229291828198955
299 { 0x1.324e600000000p-1, { 0x1.5cf7a7b8a8dafp-1, 0x1.1199c7195a664p-56 }, 1 }, // tanf(0.5982542037963867) == 0.68157695893426319218
300 { 0x1.4b34080000000p-1, { 0x1.82b608acdffb6p-1, -0x1.42d0e173a2fe0p-55 }, 1 }, // tanf(0.6468813419342041) == 0.75529505834855711174
301 { 0x1.6419ae0000000p-1, { 0x1.ab55d23619846p-1, 0x1.c603f083e9a33p-55 }, 1 }, // tanf(0.6955084204673767) == 0.8346391383208889229
302 { 0x1.7cff560000000p-1, { 0x1.d7663af1e2df4p-1, 0x1.7d485a7f8f1f9p-58 }, 1 }, // tanf(0.7441355586051941) == 0.92070182993614802475
303 { 0x1.95e4fc0000000p-1, { 0x1.03cc749c072a3p+0, -0x1.7ecea077fdf39p-59 }, 1 }, // tanf(0.7927626371383667) == 1.0148384934356406957
304 { 0x1.aecaa20000000p-1, { 0x1.1e66d51f99c48p+0, 0x1.f01ab7fb4bd0ep-56 }, 1 }, // tanf(0.8413897156715393) == 1.118756599631312936
305 { 0x1.c7b04a0000000p-1, { 0x1.3c117f90d326cp+0, 0x1.03229ff72007ap-54 }, 1 }, // tanf(0.8900168538093567) == 1.2346420029236027667
306 { 0x1.e095f00000000p-1, { 0x1.5d87230facb1cp+0, 0x1.f9a30159a1917p-54 }, 1 }, // tanf(0.9386439323425293) == 1.3653432763355289867
307 { 0x1.f97b980000000p-1, { 0x1.83c017f3edf25p+0, -0x1.b4078f9456656p-56 }, 1 }, // tanf(0.9872710704803467) == 1.5146498652010873295
308 { 0x1.0930a00000000p+0, { 0x1.b00e5d01af774p+0, 0x1.e3c0a7bf575a4p-54 }, 1 }, // tanf(1.035898208618164) == 1.6877191666712550938
309 { 0x1.15a3720000000p+0, { 0x1.e44a7c100e5ccp+0, -0x1.b003b2f2f9540p-54 }, 1 }, // tanf(1.084525227546692) == 1.8917615451049297932
310 { 0x1.2216460000000p+0, { 0x1.118f3c6a27a66p+1, 0x1.85e360e8ec4edp-58 }, 1 }, // tanf(1.1331523656845093) == 2.137183715661467259
311 { 0x1.2e891a0000000p+0, { 0x1.38444381baf3ep+1, 0x1.991d471820d23p-53 }, 1 }, // tanf(1.1817795038223267) == 2.4395832427452710076
312 { 0x1.3afbee0000000p+0, { 0x1.69672267c0dd2p+1, -0x1.d60d287c1a51cp-54 }, 1 }, // tanf(1.230406641960144) == 2.8234599119766493704
313 { 0x1.476ec00000000p+0, { 0x1.aa316732a0df3p+1, 0x1.93f5fcaa8fa55p-53 }, 1 }, // tanf(1.2790336608886719) == 3.3296326634606374182
314 { 0x1.53e1940000000p+0, { 0x1.02052da5ad457p+2, -0x1.f253167ebcf1fp-52 }, 1 }, // tanf(1.3276607990264893) == 4.0315660589158910495
315 { 0x1.6054680000000p+0, { 0x1.44dfe8084e71bp+2, 0x1.85713a302a63dp-52 }, 1 }, // tanf(1.3762879371643066) == 5.0761661606900604407
316 { 0x1.6cc73a0000000p+0, { 0x1.b398981d0788bp+2, 0x1.478f0a8738060p-53 }, 1 }, // tanf(1.4249149560928345) == 6.8061886104097865413
317 { 0x1.793a0e0000000p+0, { 0x1.47ff19f0ecd5fp+3, 0x1.fdc0680466212p-51 }, 1 }, // tanf(1.4735420942306519) == 10.249890299374498244
318 { 0x1.85ace20000000p+0, { 0x1.48c679186cc0bp+4, -0x1.a6980aa4df89ep-50 }, 1 }, // tanf(1.5221692323684692) == 20.548455329331810714
319 { 0x1.921fb60000000p+0, { -0x1.5d14946dc9897p+24, -0x1.759086954a140p-30 }, 1 }, // tanf(1.5707963705062866) == -22877332.428856459874
320 { 0x1.07e42a0000000p+5, { 0x1.8d4b1201a3a99p+11, -0x1.307422c8c1912p-45 }, 1 }, // tanf(32.98640823364258) == 3178.3459480473070133
321 { 0x1.0e2cfc0000000p+5, { -0x1.001473484f3b0p+0, -0x1.a4e3909875188p-55 }, 1 }, // tanf(33.77196502685547) == -1.0003120471512652502
322 { 0x1.1475cc0000000p+5, { -0x1.3ddbe01611c08p-20, 0x1.a01e80a914577p-74 }, 1 }, // tanf(34.557518005371094) == -1.1841166318736425066e-6
323 { 0x1.1abe9e0000000p+5, { 0x1.0014a3d53c87ap+0, -0x1.4c3b82fae134ap-54 }, 1 }, // tanf(35.343074798583984) == 1.0003149409863269338
324 { 0x1.21076e0000000p+5, { -0x1.904e6ea427870p+11, 0x1.4e728f4be16dcp-44 }, 1 }, // tanf(36.12862777709961) == -3202.4510060092942861
325};
326
327#endif // defined(HAS_TANF) || defined(HAS_LIBM_SSE2)
328
329#if defined(HAS_TANF)
330
332{
333 for (int i = 0; i < _countof(s_tanf_approx_tests); i++)
334 {
335 float x = s_tanf_approx_tests[i].x;
337 float z = tanf(x);
339 ok(error <= s_tan_approx_tests[i].max_error,
340 "tan(%.6e) = %.7e, expected %.7e, error %I64d ULPs, max %u ULPs\n",
341 x, z, expected, error, s_tan_approx_tests[i].max_error);
342 }
343}
344
345#endif // defined(HAS_TANF)
346
347#if defined(HAS_LIBM_SSE2)
348
349__ATTRIBUTE_SSE2__ __m128d __libm_sse2_tan(__m128d Xmm0);
350
352void Test_libm_sse2_tan(void)
353{
354 int i;
355 for (i = 0; i < _countof(s_tan_approx_tests); i++)
356 {
357 double x = s_tan_approx_tests[i].x;
359 __m128d xmm0 = _mm_set_sd(x);
360 __m128d xmm1 = __libm_sse2_tan(xmm0);
361 double z = _mm_cvtsd_f64(xmm1);
363 ok(error <= s_tan_approx_tests[i].max_error,
364 "__libm_sse2_tan(%.17e) = %.17e, expected %.17e, error %I64d ULPs, max %u ULPs\n",
365 x, z, expected, error, s_tan_approx_tests[i].max_error);
366 }
367}
368
369__ATTRIBUTE_SSE2__ __m128 __libm_sse2_tanf(__m128 Xmm0);
370
372void Test_libm_sse2_tanf(void)
373{
374 int i;
375 for (i = 0; i < _countof(s_tanf_approx_tests); i++)
376 {
377 float x = s_tanf_approx_tests[i].x;
379 __m128 xmm0 = _mm_set_ps1(x);
380 __m128 xmm1 = __libm_sse2_tanf(xmm0);
381 float z = _mm_cvtss_f32(xmm1);
383 ok(error <= s_tanf_approx_tests[i].max_error,
384 "__libm_sse2_tanf(%.6e) = %.7e, expected %.7e, error %I64d ULPs, max %u ULPs\n",
385 x, z, expected, error, s_tanf_approx_tests[i].max_error);
386 }
387}
388
389#endif // defined(HAS_LIBM_SSE2)
390
392{
395#if defined(HAS_TANF)
398#endif
399#if defined(HAS_LIBM_SSE2)
400 Test_libm_sse2_tan();
401 Test_libm_sse2_tanf();
402#endif
403}
_STLP_DECLSPEC complex< float > _STLP_CALL tan(const complex< float > &)
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
INT64 int64_t
Definition: types.h:72
__m128d _mm_set_sd(double w)
Definition: emmintrin.h:1037
double _mm_cvtsd_f64(__m128d a)
Definition: emmintrin.h:931
#define abs(i)
Definition: fconv.c:206
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint64EXT * result
Definition: glext.h:11304
GLdouble GLdouble z
Definition: glext.h:5874
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_ float __cdecl tanf(_In_ float x)
Definition: math.h:250
__ATTRIBUTE_SSE2__ __m128d __libm_sse2_tan(__m128d Xmm0)
Definition: libm_sse2.c:175
__ATTRIBUTE_SSE2__ __m128 __libm_sse2_tanf(__m128 Xmm0)
Definition: libm_sse2.c:182
#define ok_eq_dbl_exact(func, ullx, z, ullexp)
Definition: math_helpers.h:184
static __inline double u64_to_dbl(UINT64 x)
Definition: math_helpers.h:25
#define __ATTRIBUTE_SSE2__
Definition: math_helpers.h:19
static __inline int64_t ulp_error_precise(PRECISE_VALUE *expected, double result)
Definition: math_helpers.h:154
static __inline int ulp_error_flt(float expected, float result)
Definition: math_helpers.h:138
#define ok_eq_flt_exact(func, ux, z, uexp)
Definition: math_helpers.h:194
#define error(str)
Definition: mkdosfs.c:1605
void Test_tanf_approx(void)
Definition: tan.c:331
void Test_tan_exact(void)
Definition: tan.c:43
void Test_tan_approx(void)
Definition: tan.c:169
static TESTENTRY_DBL s_tan_exact_tests[]
Definition: tan.c:25
static TESTENTRY_DBL s_tanf_exact_tests[]
Definition: tan.c:186
void Test_tanf_exact(void)
Definition: tan.c:204
static TESTENTRY_DBL_APPROX s_tanf_approx_tests[]
Definition: tan.c:218
static TESTENTRY_DBL_APPROX s_tan_approx_tests[]
Definition: tan.c:54
BOOL expected
Definition: store.c:2000
#define _countof(array)
Definition: sndvol32.h:70
PRECISE_VALUE expected
Definition: math_helpers.h:87
float _mm_cvtss_f32(__m128 a)
Definition: xmmintrin.h:921
__m128 _mm_set_ps1(float a)