int main() { TEST_SET_START("20040930102626EJL","EJL", "negated2"); double x0n = hide_double(-0.0); double x0p = hide_double(0.0); double x1n = hide_double(-83532.96153153); double x1p = hide_double(83532.96153153); double x2n = hide_double(-0.0000000013152); double x2p = hide_double(0.0000000013152); double x3n = hide_double(-HUGE_VAL); double x3p = hide_double(HUGE_VAL); vec_double2 x0n_v = spu_splats(x0n); vec_double2 x0p_v = spu_splats(x0p); vec_double2 x1n_v = spu_splats(x1n); vec_double2 x1p_v = spu_splats(x1p); vec_double2 x2n_v = spu_splats(x2n); vec_double2 x2p_v = spu_splats(x2p); vec_double2 x3n_v = spu_splats(x3n); vec_double2 x3p_v = spu_splats(x3p); vec_double2 res_v; TEST_START("negated2"); res_v = negated2(x0n_v); TEST_CHECK("20040930102629EJL", allequal_double2( res_v, x0p_v ), 0); res_v = negated2(x0p_v); TEST_CHECK("20040930102631EJL", allequal_double2( res_v, x0n_v ), 0); res_v = negated2(x1n_v); TEST_CHECK("20040930102632EJL", allequal_double2( res_v, x1p_v ), 0); res_v = negated2(x1p_v); TEST_CHECK("20040930102635EJL", allequal_double2( res_v, x1n_v ), 0); res_v = negated2(x2n_v); TEST_CHECK("20040930102637EJL", allequal_double2( res_v, x2p_v ), 0); res_v = negated2(x2p_v); TEST_CHECK("20040930102639EJL", allequal_double2( res_v, x2n_v ), 0); res_v = negated2(x3n_v); TEST_CHECK("20040930102641EJL", allposinf_double2( res_v ), 0); res_v = negated2(x3p_v); TEST_CHECK("20040930102643EJL", allneginf_double2( res_v ), 0); TEST_SET_DONE(); TEST_EXIT(); }
int main() { TEST_SET_START("20040908022501EJL","EJL", "fabs"); double x0n = hide_double(-0.0); double x0p = hide_double(0.0); double x1n = hide_double(-83532.96153153); double x1p = hide_double(83532.96153153); double x2n = hide_double(-0.0000000013152); double x2p = hide_double(0.0000000013152); double x3n = hide_double(-HUGE_VAL); double x3p = hide_double(HUGE_VAL); vec_double2 x0n_v = spu_splats(x0n); vec_double2 x0p_v = spu_splats(x0p); vec_double2 x1n_v = spu_splats(x1n); vec_double2 x1p_v = spu_splats(x1p); vec_double2 x2n_v = spu_splats(x2n); vec_double2 x2p_v = spu_splats(x2p); vec_double2 x3n_v = spu_splats(x3n); vec_double2 x3p_v = spu_splats(x3p); double res; vec_double2 res_v; TEST_START("fabsd2"); res_v = fabsd2(x0n_v); TEST_CHECK("20040908022502EJL", allequal_double2( res_v, x0p_v ), 0); res_v = fabsd2(x0p_v); TEST_CHECK("20040908022503EJL", allequal_double2( res_v, x0p_v ), 0); res_v = fabsd2(x1n_v); TEST_CHECK("20040908022504EJL", allequal_double2( res_v, x1p_v ), 0); res_v = fabsd2(x1p_v); TEST_CHECK("20040908022505EJL", allequal_double2( res_v, x1p_v ), 0); res_v = fabsd2(x2n_v); TEST_CHECK("20040908022506EJL", allequal_double2( res_v, x2p_v ), 0); res_v = fabsd2(x2p_v); TEST_CHECK("20040908022507EJL", allequal_double2( res_v, x2p_v ), 0); res_v = fabsd2(x3n_v); TEST_CHECK("20040908022508EJL", allposinf_double2( res_v ), 0); res_v = fabsd2(x3p_v); TEST_CHECK("20040908022509EJL", allposinf_double2( res_v ), 0); TEST_START("fabs"); res = fabs( x0n ); TEST_CHECK("20040908022510EJL", res == x0p, 0); res = fabs( x0p ); TEST_CHECK("20040908022511EJL", res == x0p, 0); res = fabs( x1n ); TEST_CHECK("20040908022512EJL", res == x1p, 0); res = fabs( x1p ); TEST_CHECK("20040908022513EJL", res == x1p, 0); res = fabs( x2n ); TEST_CHECK("20040908022514EJL", res == x2p, 0); res = fabs( x2p ); TEST_CHECK("20040908022515EJL", res == x2p, 0); res = fabs( x3n ); TEST_CHECK("20040908022516EJL", isinf(res) == 1, 0); res = fabs( x3p ); TEST_CHECK("20040908022517EJL", isinf(res) == 1, 0); TEST_SET_DONE(); TEST_EXIT(); }
int main() { TEST_SET_START("20040928174038EJL","EJL", "rsqrtd2"); unsigned long long i6 = 0x7464fff515d76f87ull; unsigned long long i6r = 0x25b3c03b72dba06cull; unsigned long long i7 = 0x7606a4533cf5605eull; unsigned long long i7r = 0x24e3056f4b45f6a9ull; unsigned long long i8 = 0x4beae58c6f48733eull; unsigned long long i8r = 0x39f173b787396c5full; unsigned long long i9 = 0x3999ed5c8316b00bull; unsigned long long i9r = 0x43192359a70ec761ull; unsigned long long i10 = 0x68f7885c4b84b793ull; unsigned long long i10r = 0x2b6a62d48c269d90ull; unsigned long long i11 = 0x1aabc083c5c26227ull; unsigned long long i11r = 0x52912e543817fabbull; double x0 = hide_double(-HUGE_VAL); // -Inf -> NaN double x1 = hide_double(HUGE_VAL); // Inf -> +0 double x2 = hide_double(0.0); // +0 -> Inf double x3 = hide_double(-0.0); // -0 -> -Inf double x4 = hide_double(nan("")); // NaN -> NaN double x5 = hide_double(4.0); double x5r = hide_double(0.5); double x6 = hide_double(make_double(i6)); double x6r = hide_double(make_double(i6r)); double x7 = hide_double(make_double(i7)); double x7r = hide_double(make_double(i7r)); double x8 = hide_double(make_double(i8)); double x8r = hide_double(make_double(i8r)); double x9 = hide_double(make_double(i9)); double x9r = hide_double(make_double(i9r)); double x10 = hide_double(make_double(i10)); double x10r = hide_double(make_double(i10r)); double x11 = hide_double(make_double(i11)); double x11r = hide_double(make_double(i11r)); vec_double2 x0_v = spu_splats(x0); vec_double2 x1_v = spu_splats(x1); vec_double2 x2_v = spu_splats(x2); vec_double2 x3_v = spu_splats(x3); vec_double2 x4_v = spu_splats(x4); vec_double2 x5_v = spu_splats(x5); vec_double2 x5r_v = spu_splats(x5r); vec_double2 x6_v = spu_splats(x6); vec_double2 x6r_v = spu_splats(x6r); vec_double2 x7_v = spu_splats(x7); vec_double2 x7r_v = spu_splats(x7r); vec_double2 x8_v = spu_splats(x8); vec_double2 x8r_v = spu_splats(x8r); vec_double2 x9_v = spu_splats(x9); vec_double2 x9r_v = spu_splats(x9r); vec_double2 x10_v = spu_splats(x10); vec_double2 x10r_v = spu_splats(x10r); vec_double2 x11_v = spu_splats(x11); vec_double2 x11r_v = spu_splats(x11r); vec_double2 res_v; TEST_START("rsqrtd2"); res_v = rsqrtd2(x0_v); TEST_CHECK("20040928174042EJL", allnan_double2( res_v ), 0); res_v = rsqrtd2(x1_v); TEST_CHECK("20040928174045EJL", allposzero_double2( res_v ), 0); res_v = rsqrtd2(x2_v); TEST_CHECK("20040928174047EJL", allposinf_double2( res_v ), 0); res_v = rsqrtd2(x3_v); TEST_CHECK("20040928174049EJL", allneginf_double2( res_v ), 0); res_v = rsqrtd2(x4_v); TEST_CHECK("20040928174054EJL", allnan_double2( res_v ), 0); res_v = rsqrtd2(x5_v); TEST_CHECK("20040928174058EJL", allequal_double2( res_v, x5r_v ), 0); res_v = rsqrtd2(x6_v); TEST_CHECK("20040928174101EJL", allequal_ulps_double2( res_v, x6r_v, 1 ), 0); res_v = rsqrtd2(x7_v); TEST_CHECK("20040928174104EJL", allequal_ulps_double2( res_v, x7r_v, 1 ), 0); res_v = rsqrtd2(x8_v); TEST_CHECK("20040928174106EJL", allequal_ulps_double2( res_v, x8r_v, 1 ), 0); res_v = rsqrtd2(x9_v); TEST_CHECK("20040928174108EJL", allequal_ulps_double2( res_v, x9r_v, 1 ), 0); res_v = rsqrtd2(x10_v); TEST_CHECK("20040928174110EJL", allequal_ulps_double2( res_v, x10r_v, 1 ), 0); res_v = rsqrtd2(x11_v); TEST_CHECK("20040928174113EJL", allequal_ulps_double2( res_v, x11r_v, 1 ), 0); TEST_SET_DONE(); TEST_EXIT(); }
int main() { TEST_SET_START("20040920095218EJL","EJL", "recipd2"); unsigned long long i6 = 0x7fd0000000000001ull; // 2^1022 + 1 ulp unsigned long long i7 = 0xffd0000000000000ull; // -2^1022 unsigned long long i7r = 0x8010000000000000ull; // -2^-1022 unsigned long long i8 = 0x7606a4533cf5605eull; // random values unsigned long long i8r = 0x09d69cea2b5b5b57ull; unsigned long long i9 = 0x4c042c295376566eull; unsigned long long i9r = 0x33d9618e87b961f4ull; unsigned long long i10 = 0x39b3720562510408ull; unsigned long long i10r = 0x462a54842d7f9b5dull; unsigned long long i11 = 0x6911a64538a389aeull; unsigned long long i11r = 0x16cd02637ed13ff2ull; unsigned long long i12 = 0x1ac4d062d451c99dull; unsigned long long i12r = 0x6518994c26ebbb3eull; double x0 = hide_double(-HUGE_VAL); // -Inf double x1 = hide_double(HUGE_VAL); // Inf double x2 = hide_double(0.0); // 0 double x3 = hide_double(-0.0); // -0 double x4 = hide_double(nan("")); // NaN double x5 = hide_double(2.0); double x5r = hide_double(0.5); double x6 = hide_double(make_double(i6)); double x7 = hide_double(make_double(i7)); double x7r = hide_double(make_double(i7r)); double x8 = hide_double(make_double(i8)); double x8r = hide_double(make_double(i8r)); double x9 = hide_double(make_double(i9)); double x9r = hide_double(make_double(i9r)); double x10 = hide_double(make_double(i10)); double x10r = hide_double(make_double(i10r)); double x11 = hide_double(make_double(i11)); double x11r = hide_double(make_double(i11r)); double x12 = hide_double(make_double(i12)); double x12r = hide_double(make_double(i12r)); vec_double2 x0_v = spu_splats(x0); vec_double2 x1_v = spu_splats(x1); vec_double2 x2_v = spu_splats(x2); vec_double2 x3_v = spu_splats(x3); vec_double2 x4_v = spu_splats(x4); vec_double2 x5_v = spu_splats(x5); vec_double2 x5r_v = spu_splats(x5r); vec_double2 x6_v = spu_splats(x6); vec_double2 x7_v = spu_splats(x7); vec_double2 x7r_v = spu_splats(x7r); vec_double2 x8_v = spu_splats(x8); vec_double2 x8r_v = spu_splats(x8r); vec_double2 x9_v = spu_splats(x9); vec_double2 x9r_v = spu_splats(x9r); vec_double2 x10_v = spu_splats(x10); vec_double2 x10r_v = spu_splats(x10r); vec_double2 x11_v = spu_splats(x11); vec_double2 x11r_v = spu_splats(x11r); vec_double2 x12_v = spu_splats(x12); vec_double2 x12r_v = spu_splats(x12r); vec_double2 res_v; TEST_START("recipd2"); res_v = recipd2(x0_v); TEST_CHECK("20040920095224EJL", allnegzero_double2( res_v ), 0); res_v = recipd2(x1_v); TEST_CHECK("20040920095226EJL", allposzero_double2( res_v ), 0); res_v = recipd2(x2_v); TEST_CHECK("20040920095228EJL", allposinf_double2( res_v ), 0); res_v = recipd2(x3_v); TEST_CHECK("20040920095233EJL", allneginf_double2( res_v ), 0); res_v = recipd2(x4_v); TEST_CHECK("20040920095235EJL", allnan_double2( res_v ), 0); res_v = recipd2(x5_v); TEST_CHECK("20040920095237EJL", allequal_double2( res_v, x5r_v ), 0); res_v = recipd2(x6_v); TEST_CHECK("20040920095239EJL", allzerodenorm_double2( res_v ), 0); res_v = recipd2(x7_v); TEST_CHECK("20040920095242EJL", allequal_double2( res_v, x7r_v ), 0); res_v = recipd2(x8_v); TEST_CHECK("20040920095245EJL", allequal_ulps_double2( res_v, x8r_v, 1 ), 0); res_v = recipd2(x9_v); TEST_CHECK("20040920095247EJL", allequal_ulps_double2( res_v, x9r_v, 1 ), 0); res_v = recipd2(x10_v); TEST_CHECK("20040920095248EJL", allequal_ulps_double2( res_v, x10r_v, 1 ), 0); res_v = recipd2(x11_v); TEST_CHECK("20040920095250EJL", allequal_ulps_double2( res_v, x11r_v, 1 ), 0); res_v = recipd2(x12_v); TEST_CHECK("20040920095252EJL", allequal_ulps_double2( res_v, x12r_v, 1 ), 0); TEST_SET_DONE(); TEST_EXIT(); }
int main() { TEST_SET_START("20060824103000MH","MH", "fmind2_fmaxd2"); double denorm_min = hide_double(make_double(0x0000000000000001ull)); double denorm_max = hide_double(make_double(0x000fffffffffffffull)); double norm_min = hide_double(make_double(0x0010000000000000ull)); double norm_max = hide_double(make_double(0x7fefffffffffffffull)); double x0min = hide_double(1760.135); double x0max = hide_double(19355.03); double x1min = hide_double(-12351.9); double x1max = hide_double(-139.035); double x2min = hide_double(-1.0); double x2max = hide_double(0.0); double x3min = hide_double(nan("")); double x3max = hide_double(-1.0); double x4min = hide_double(-0.0); double x4max = hide_double(0.0); double x5min = denorm_min; double x5max = hide_double(1.0e-323); double x6min = norm_max; double x6max = hide_double(HUGE_VAL); double x7min = hide_double(-HUGE_VAL); double x7max = hide_double(19355.03); double x8min = hide_double(-HUGE_VAL); double x8max = hide_double(HUGE_VAL); double x9min = denorm_max; double x9max = norm_min; vec_double2 x0min_v = spu_splats(x0min); vec_double2 x0max_v = spu_splats(x0max); vec_double2 x1min_v = spu_splats(x1min); vec_double2 x1max_v = spu_splats(x1max); vec_double2 x2min_v = spu_splats(x2min); vec_double2 x2max_v = spu_splats(x2max); vec_double2 x3min_v = spu_splats(x3min); vec_double2 x3max_v = spu_splats(x3max); vec_double2 x4min_v = spu_splats(x4min); vec_double2 x4max_v = spu_splats(x4max); vec_double2 x5min_v = spu_splats(x5min); vec_double2 x5max_v = spu_splats(x5max); vec_double2 x6min_v = spu_splats(x6min); vec_double2 x6max_v = spu_splats(x6max); vec_double2 x7min_v = spu_splats(x7min); vec_double2 x7max_v = spu_splats(x7max); vec_double2 x8min_v = spu_splats(x8min); vec_double2 x8max_v = spu_splats(x8max); vec_double2 x9min_v = spu_splats(x9min); vec_double2 x9max_v = spu_splats(x9max); vec_double2 x51min_v = (vec_double2){x5min, x1min}; vec_double2 x51max_v = (vec_double2){x5max, x1max}; vec_double2 res_v; TEST_START("fmind2"); res_v = fmind2(x0min_v, x0max_v); TEST_CHECK("20060824103001MH", allequal_double2( res_v, x0min_v ), 0); res_v = fmind2(x0max_v, x0min_v); TEST_CHECK("20060824103002MH", allequal_double2( res_v, x0min_v ), 0); res_v = fmind2(x1min_v, x1max_v); TEST_CHECK("20060824103003MH", allequal_double2( res_v, x1min_v ), 0); res_v = fmind2(x1max_v, x1min_v); TEST_CHECK("20060824103004MH", allequal_double2( res_v, x1min_v ), 0); res_v = fmind2(x2min_v, x2max_v); TEST_CHECK("20060824103005MH", allequal_double2( res_v, x2min_v ), 0); res_v = fmind2(x2max_v, x2min_v); TEST_CHECK("20060824103006MH", allequal_double2( res_v, x2min_v ), 0); res_v = fmind2(x3min_v, x3max_v); TEST_CHECK("20060824103007MH", allequal_double2( res_v, x3max_v ), 0); res_v = fmind2(x3max_v, x3min_v); TEST_CHECK("20060824103008MH", allequal_double2( res_v, x3max_v ), 0); res_v = fmind2(x4min_v, x4max_v); TEST_CHECK("20060824103009MH", allequal_double2( res_v, x4min_v ), 0); res_v = fmind2(x4max_v, x4min_v); TEST_CHECK("20060824103010MH", allequal_double2( res_v, x4min_v ), 0); res_v = fmind2(x5min_v, x5max_v); TEST_CHECK("20060824103011MH", allequal_double2( res_v, x5min_v ), 0); res_v = fmind2(x5max_v, x5min_v); TEST_CHECK("20060824103012MH", allequal_double2( res_v, x5min_v ), 0); res_v = fmind2(x6min_v, x6max_v); TEST_CHECK("20060824103013MH", allequal_double2( res_v, x6min_v ), 0); res_v = fmind2(x6max_v, x6min_v); TEST_CHECK("20060824103014MH", allequal_double2( res_v, x6min_v ), 0); res_v = fmind2(x7min_v, x7max_v); TEST_CHECK("20060824103015MH", allequal_double2( res_v, x7min_v ), 0); res_v = fmind2(x7max_v, x7min_v); TEST_CHECK("20060824103016MH", allequal_double2( res_v, x7min_v ), 0); res_v = fmind2(x8min_v, x8max_v); TEST_CHECK("20060824103017MH", allequal_double2( res_v, x8min_v ), 0); res_v = fmind2(x8max_v, x8min_v); TEST_CHECK("20060824103018MH", allequal_double2( res_v, x8min_v ), 0); res_v = fmind2(x9min_v, x9max_v); TEST_CHECK("20060824103019MH", allequal_double2( res_v, x9min_v ), 0); res_v = fmind2(x9max_v, x9min_v); TEST_CHECK("20060824103020MH", allequal_double2( res_v, x9min_v ), 0); res_v = fmind2(x51min_v, x51max_v); TEST_CHECK("20060824103021MH", allequal_double2( res_v, x51min_v ), 0); res_v = fmind2(x51max_v, x51min_v); TEST_CHECK("20060824103022MH", allequal_double2( res_v, x51min_v ), 0); TEST_START("fmaxd2"); res_v = fmaxd2(x0min_v, x0max_v); TEST_CHECK("20060824103101MH", allequal_double2( res_v, x0max_v ), 0); res_v = fmaxd2(x0max_v, x0min_v); TEST_CHECK("20060824103102MH", allequal_double2( res_v, x0max_v ), 0); res_v = fmaxd2(x1min_v, x1max_v); TEST_CHECK("20060824103103MH", allequal_double2( res_v, x1max_v ), 0); res_v = fmaxd2(x1max_v, x1min_v); TEST_CHECK("20060824103104MH", allequal_double2( res_v, x1max_v ), 0); res_v = fmaxd2(x2min_v, x2max_v); TEST_CHECK("20060824103105MH", allequal_double2( res_v, x2max_v ), 0); res_v = fmaxd2(x2max_v, x2min_v); TEST_CHECK("20060824103106MH", allequal_double2( res_v, x2max_v ), 0); res_v = fmaxd2(x3min_v, x3max_v); TEST_CHECK("20060824103107MH", allequal_double2( res_v, x3max_v ), 0); res_v = fmaxd2(x3max_v, x3min_v); TEST_CHECK("20060824103108MH", allequal_double2( res_v, x3max_v ), 0); res_v = fmaxd2(x4min_v, x4max_v); TEST_CHECK("20060824103109MH", allequal_double2( res_v, x4max_v ), 0); res_v = fmaxd2(x4max_v, x4min_v); TEST_CHECK("20060824103110MH", allequal_double2( res_v, x4max_v ), 0); res_v = fmaxd2(x5min_v, x5max_v); TEST_CHECK("20060824103111MH", allequal_double2( res_v, x5max_v ), 0); res_v = fmaxd2(x5max_v, x5min_v); TEST_CHECK("20060824103112MH", allequal_double2( res_v, x5max_v ), 0); res_v = fmaxd2(x6min_v, x6max_v); TEST_CHECK("20060824103113MH", allequal_double2( res_v, x6max_v ), 0); res_v = fmaxd2(x6max_v, x6min_v); TEST_CHECK("20060824103114MH", allequal_double2( res_v, x6max_v ), 0); res_v = fmaxd2(x7min_v, x7max_v); TEST_CHECK("20060824103115MH", allequal_double2( res_v, x7max_v ), 0); res_v = fmaxd2(x7max_v, x7min_v); TEST_CHECK("20060824103116MH", allequal_double2( res_v, x7max_v ), 0); res_v = fmaxd2(x8min_v, x8max_v); TEST_CHECK("20060824103117MH", allequal_double2( res_v, x8max_v ), 0); res_v = fmaxd2(x8max_v, x8min_v); TEST_CHECK("20060824103118MH", allequal_double2( res_v, x8max_v ), 0); res_v = fmaxd2(x9min_v, x9max_v); TEST_CHECK("20060824103119MH", allequal_double2( res_v, x9max_v ), 0); res_v = fmaxd2(x9max_v, x9min_v); TEST_CHECK("20060824103120MH", allequal_double2( res_v, x9max_v ), 0); res_v = fmaxd2(x51min_v, x51max_v); TEST_CHECK("20060824103121MH", allequal_double2( res_v, x51max_v ), 0); res_v = fmaxd2(x51max_v, x51min_v); TEST_CHECK("20060824103122MH", allequal_double2( res_v, x51max_v ), 0); TEST_SET_DONE(); TEST_EXIT(); }