void test_remquo() { int ip; static_assert((std::is_same<decltype(remquo((double)0, (double)0, &ip)), double>::value), ""); static_assert((std::is_same<decltype(remquof(0,0, &ip)), float>::value), ""); static_assert((std::is_same<decltype(remquol(0,0, &ip)), long double>::value), ""); assert(remquo(0.5,1, &ip) == 0.5); }
static void test_invalid(long double x, long double y) { int q; q = 0xdeadbeef; assert(isnan(remainder(x, y))); assert(isnan(remquo(x, y, &q))); #ifdef STRICT assert(q == 0xdeadbeef); #endif assert(isnan(remainderf(x, y))); assert(isnan(remquof(x, y, &q))); #ifdef STRICT assert(q == 0xdeadbeef); #endif assert(isnan(remainderl(x, y))); assert(isnan(remquol(x, y, &q))); #ifdef STRICT assert(q == 0xdeadbeef); #endif }
NT2_TEST_CASE_TPL(remquo_table, NT2_REAL_TYPES) { typedef typename nt2::meta::as_integer<T>::type iT; // Reference values nt2::table<T> v = nt2::rowvect(nt2::cons(T(1),T(2),T(3),T(4.5),T(7.1))); nt2::table<T> im(nt2::extent(v)); nt2::table<iT> ie(nt2::extent(v)); std::size_t nb = nt2::numel(v); for(std::size_t i=1; i <= nb; ++i) { im(i) = nt2::remquo(v(i), T(i*2), ie(i)); } { // -1 to test resizing works properly nt2::table<T> m(nt2::of_size(nb-1)); nt2::table<iT> e(nt2::of_size(nb)); nt2::remquo(v,nt2::linspace(T(2),T(10),nb),m,e); NT2_TEST_EQUAL(m, im); NT2_TEST_EQUAL(e, ie); } { // -1 to test resizing works properly nt2::table<T> m(nt2::of_size(nb-1)); nt2::table<iT> e(nt2::of_size(nb)); m = remquo(v, nt2::linspace(T(2),T(10),nb), e); NT2_TEST_EQUAL(m, im); NT2_TEST_EQUAL(e, ie); } { // -1 to test resizing works properly nt2::table<T> m(nt2::of_size(nb-1)); nt2::table<iT> e(nt2::of_size(nb)); nt2::tie(m, e) = nt2::remquo(v,nt2::linspace(T(2),T(10),nb)); NT2_TEST_EQUAL(m, im); NT2_TEST_EQUAL(e, ie); } { // -1 to test resizing works properly nt2::table<T> m(nt2::of_size(nb-1)); m = nt2::remquo(v,nt2::linspace(T(2),T(10),nb)); NT2_TEST_EQUAL(m, im); } }
CAMLprim value math_remquo(value x, value y) { CAMLparam2(x, y); CAMLlocal1(z); double a; int i; a = remquo(Double_val(x), Double_val(y), &i); z = caml_alloc(2, 0); Store_field(z, 0, caml_copy_double(a)); Store_field(z, 1, Val_int(i)); CAMLreturn(z); }
static void testd(double x, double y, double expected_rem, int expected_quo) { int q; double rem; q = random(); rem = remainder(x, y); assert(rem == expected_rem); assert(!signbit(rem) == !signbit(expected_rem)); rem = remquo(x, y, &q); assert(rem == expected_rem); assert(!signbit(rem) == !signbit(expected_rem)); assert((q ^ expected_quo) >= 0); /* sign(q) == sign(expected_quo) */ assert((q & 0x7) == (expected_quo & 0x7)); if (q != 0) { assert((q > 0) ^ !(expected_quo > 0)); q = abs(q); assert(q == (abs(expected_quo) & mask(q))); } }
static void F(compile_test) (void) { TYPE a, b, c = 1.0; complex TYPE d; int i; int saved_count; long int j; long long int k; a = cos (cos (x)); b = acos (acos (a)); a = sin (sin (x)); b = asin (asin (a)); a = tan (tan (x)); b = atan (atan (a)); c = atan2 (atan2 (a, c), atan2 (b, x)); a = cosh (cosh (x)); b = acosh (acosh (a)); a = sinh (sinh (x)); b = asinh (asinh (a)); a = tanh (tanh (x)); b = atanh (atanh (a)); a = exp (exp (x)); b = log (log (a)); a = log10 (log10 (x)); b = ldexp (ldexp (a, 1), 5); a = frexp (frexp (x, &i), &i); b = expm1 (expm1 (a)); a = log1p (log1p (x)); b = logb (logb (a)); a = exp2 (exp2 (x)); b = log2 (log2 (a)); a = pow (pow (x, a), pow (c, b)); b = sqrt (sqrt (a)); a = hypot (hypot (x, b), hypot (c, a)); b = cbrt (cbrt (a)); a = ceil (ceil (x)); b = fabs (fabs (a)); a = floor (floor (x)); b = fmod (fmod (a, b), fmod (c, x)); a = nearbyint (nearbyint (x)); b = round (round (a)); a = trunc (trunc (x)); b = remquo (remquo (a, b, &i), remquo (c, x, &i), &i); j = lrint (x) + lround (a); k = llrint (b) + llround (c); a = erf (erf (x)); b = erfc (erfc (a)); a = tgamma (tgamma (x)); b = lgamma (lgamma (a)); a = rint (rint (x)); b = nextafter (nextafter (a, b), nextafter (c, x)); a = nextdown (nextdown (a)); b = nexttoward (nexttoward (x, a), c); a = nextup (nextup (a)); b = remainder (remainder (a, b), remainder (c, x)); a = scalb (scalb (x, a), (TYPE) (6)); k = scalbn (a, 7) + scalbln (c, 10l); i = ilogb (x); j = llogb (x); a = fdim (fdim (x, a), fdim (c, b)); b = fmax (fmax (a, x), fmax (c, b)); a = fmin (fmin (x, a), fmin (c, b)); b = fma (sin (a), sin (x), sin (c)); a = totalorder (totalorder (x, b), totalorder (c, x)); b = totalordermag (totalordermag (x, a), totalordermag (c, x)); #ifdef TEST_INT a = atan2 (i, b); b = remquo (i, a, &i); c = fma (i, b, i); a = pow (i, c); #endif x = a + b + c + i + j + k; saved_count = count; if (ccount != 0) ccount = -10000; d = cos (cos (z)); z = acos (acos (d)); d = sin (sin (z)); z = asin (asin (d)); d = tan (tan (z)); z = atan (atan (d)); d = cosh (cosh (z)); z = acosh (acosh (d)); d = sinh (sinh (z)); z = asinh (asinh (d)); d = tanh (tanh (z)); z = atanh (atanh (d)); d = exp (exp (z)); z = log (log (d)); d = sqrt (sqrt (z)); z = conj (conj (d)); d = fabs (conj (a)); z = pow (pow (a, d), pow (b, z)); d = cproj (cproj (z)); z += fabs (cproj (a)); a = carg (carg (z)); b = creal (creal (d)); c = cimag (cimag (z)); x += a + b + c + i + j + k; z += d; if (saved_count != count) count = -10000; if (0) { a = cos (y); a = acos (y); a = sin (y); a = asin (y); a = tan (y); a = atan (y); a = atan2 (y, y); a = cosh (y); a = acosh (y); a = sinh (y); a = asinh (y); a = tanh (y); a = atanh (y); a = exp (y); a = log (y); a = log10 (y); a = ldexp (y, 5); a = frexp (y, &i); a = expm1 (y); a = log1p (y); a = logb (y); a = exp2 (y); a = log2 (y); a = pow (y, y); a = sqrt (y); a = hypot (y, y); a = cbrt (y); a = ceil (y); a = fabs (y); a = floor (y); a = fmod (y, y); a = nearbyint (y); a = round (y); a = trunc (y); a = remquo (y, y, &i); j = lrint (y) + lround (y); k = llrint (y) + llround (y); a = erf (y); a = erfc (y); a = tgamma (y); a = lgamma (y); a = rint (y); a = nextafter (y, y); a = nexttoward (y, y); a = remainder (y, y); a = scalb (y, (const TYPE) (6)); k = scalbn (y, 7) + scalbln (y, 10l); i = ilogb (y); j = llogb (y); a = fdim (y, y); a = fmax (y, y); a = fmin (y, y); a = fma (y, y, y); a = totalorder (y, y); a = totalordermag (y, y); #ifdef TEST_INT a = atan2 (i, y); a = remquo (i, y, &i); a = fma (i, y, i); a = pow (i, y); #endif d = cos ((const complex TYPE) z); d = acos ((const complex TYPE) z); d = sin ((const complex TYPE) z); d = asin ((const complex TYPE) z); d = tan ((const complex TYPE) z); d = atan ((const complex TYPE) z); d = cosh ((const complex TYPE) z); d = acosh ((const complex TYPE) z); d = sinh ((const complex TYPE) z); d = asinh ((const complex TYPE) z); d = tanh ((const complex TYPE) z); d = atanh ((const complex TYPE) z); d = exp ((const complex TYPE) z); d = log ((const complex TYPE) z); d = sqrt ((const complex TYPE) z); d = pow ((const complex TYPE) z, (const complex TYPE) z); d = fabs ((const complex TYPE) z); d = carg ((const complex TYPE) z); d = creal ((const complex TYPE) z); d = cimag ((const complex TYPE) z); d = conj ((const complex TYPE) z); d = cproj ((const complex TYPE) z); } }
float remquof (float x, float y, int *quo) { return (float) remquo( (double)x, (double)y, quo ); }
double remainder(double x, double y) { int q; return remquo(x, y, &q); }
double remainder ( double x, double y ) { int quo; return ( remquo( x, y, &quo )); }
sl_def(do_test, void) { #define x values[p].d #define xf values[p].f #define y values[p+1].d #define yf values[p+1].f #define n values[p+2].i #define nl values[p+2].l #define call1(F) \ values[p].desc = #F; \ values[p].d = F(x); \ ++p; \ values[p].desc = #F "f"; \ values[p].f = F ## f (xf); \ ++p #define call1i(F) \ values[p].desc = #F; \ values[p].i = F(x); \ ++p #define call2(F) \ values[p].desc = #F; \ values[p].d = F(x, y); \ p += 2; \ values[p].desc = #F "f"; \ values[p].f = F ## f (xf, yf); \ p += 2 #define call2i(F) \ values[p].desc = #F; \ values[p].i = F(x, y); \ p += 2; \ values[p].desc = #F "f"; \ values[p].i = F(xf, yf); \ p += 2 /* classify */ call1i(fpclassify); call1i(signbit); call1i(isfinite); call1i(isnormal); call1i(isnan); call1i(isinf); /* trig */ call1(acos); call1(asin); call1(atan); call2(atan2); call1(cos); call1(sin); call1(tan); /* hyperbolic */ call1(acosh); call1(asinh); call1(atanh); call1(cosh); call1(sinh); call1(tanh); /* exp/log */ call1(exp); call1(exp2); call1(expm1); values[p].desc = "frexp"; values[p].d = frexp(x, &values[p+1].i); p += 2; values[p].desc = "frexpf"; values[p].f = frexpf(xf, &values[p+1].i); p += 2; values[p].desc = "ilogb"; values[p].i = ilogb(x); p++; values[p].desc = "ilogbf"; values[p].i = ilogbf(xf); p++; values[p].desc = "ldexp"; values[p].d = ldexp(x, n); p+=3; values[p].desc = "ldexpf"; values[p].f = ldexpf(xf, n); p+=3; call1(log); call1(log10); call1(log1p); call1(log2); call1(logb); values[p].desc = "modf"; values[p].d = modf(x, &y); p += 2; values[p].desc = "modff"; values[p].f = modff(xf, &yf); p += 2; values[p].desc = "scalbn"; values[p].d = scalbn(x, n); p+=3; values[p].desc = "scalbnf"; values[p].f = scalbnf(xf, n); p+=3; values[p].desc = "scalbln"; values[p].d = scalbln(x, nl); p+=3; values[p].desc = "scalblnf"; values[p].f = scalblnf(xf, nl); p+=3; /* power/abs */ call1(cbrt); call1(fabs); call2(hypot); call2(pow); call1(sqrt); /* error/gamma */ call1(erf); call1(erfc); call1(lgamma); call1(tgamma); call1(ceil); call1(floor); call1(nearbyint); call1(rint); call1(lrint); values[p].desc = "lrint"; values[p].l = lrint(x); p++; values[p].desc = "lrintf"; values[p].l = lrintf(xf); p++; values[p].desc = "llrint"; values[p].ll = llrint(x); p++; values[p].desc = "llrintf"; values[p].ll = llrintf(xf); p++; call1(round); values[p].desc = "lround"; values[p].l = lround(x); p++; values[p].desc = "lroundf"; values[p].l = lroundf(xf); p++; values[p].desc = "llround"; values[p].ll = llround(x); p++; values[p].desc = "llroundf"; values[p].ll = llroundf(xf); p++; call1(trunc); /* rem/mod */ call2(fmod); call2(remainder); values[p].desc = "remquo"; values[p].d = remquo(x, y, &values[p+1].i); p+=2; values[p].desc = "remquof"; values[p].f = remquof(xf, yf, &values[p+1].i); p+=2; call2(copysign); /* nan */ values[p].desc = "nan"; values[p].d = nan(""); ++p; values[p].desc = "nanf"; values[p].f = nanf(""); ++p; call2(nextafter); /* min/max/dim */ call2(fdim); call2(fmax); call2(fmin); values[p].desc = "fma"; values[p].d = fma(x, y, values[p+2].d); p+=3; values[p].desc = "fmaf"; values[p].d = fmaf(xf, yf, values[p+2].f); p+=3; /* comp */ call2i(isgreater); call2i(isgreaterequal); call2i(isless); call2i(islessequal); call2i(islessgreater); call2i(isunordered); #undef x #undef xf #undef y #undef n }
void fun_C(int x, int y, int z) { c=remquo(a, b, &d); printf("%lf, %d\n", c, d); }
TEST(math, remquo) { int q; double d = remquo(13.0, 4.0, &q); ASSERT_EQ(3, q); ASSERT_DOUBLE_EQ(1.0, d); }
long double remquol(long double x, long double y, int* i) { return remquo((double)x, (double)y, i); }
__attribute__((weak)) long double remquol(long double x, long double y, int* i) { return remquo((double)x, (double)y, i); }
void math (double d, int *ex, double *dp) { acos (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 8 } */ acosh (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 10 } */ asin (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 12 } */ asinh (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 14 } */ atan (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 16 } */ atanh (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 18 } */ atan2 (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 20 } */ cbrt (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 22 } */ ceil (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 24 } */ copysign (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 26 } */ cos (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 28 } */ cosh (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 30 } */ erf (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 32 } */ erfc (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 34 } */ exp (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 36 } */ exp2 (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 38 } */ expm1 (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 40 } */ fabs (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 42 } */ fdim (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 44 } */ floor (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 46 } */ fma (d, d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 48 } */ fmax (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 50 } */ fmin (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 52 } */ fmod (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 54 } */ frexp (d, ex); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 56 } */ hypot (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 58 } */ /* We don't generate the warning for ilogb. */ ilogb (d); ldexp (d, *ex); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 62 } */ lgamma (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 64 } */ llrint (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 66 } */ llround (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 68 } */ log (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 70 } */ log10 (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 72 } */ log1p (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 74 } */ log2 (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 76 } */ logb (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 78 } */ lrint (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 80 } */ lround (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 82 } */ modf (d, dp); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 84 } */ nan (""); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 86 } */ nearbyint (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 88 } */ nextafter (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 90 } */ nexttoward (d, 20.0L); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 92 } */ pow (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 94 } */ remainder (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 96 } */ remquo (d, d, ex); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 98 } */ rint (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 100 } */ round (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 102 } */ scalbln (d, 100L); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 104 } */ scalbn (d, 100); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 106 } */ sin (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 108 } */ sinh (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 110 } */ sincos (d, dp, dp); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 112 } */ sqrt (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 114 } */ tan (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 116 } */ tanh (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 118 } */ tgamma (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 120 } */ trunc (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 122 } */ }
void domath (void) { #ifndef NO_DOUBLE double f1; double f2; int i1; f1 = acos (0.0); fprintf( stdout, "acos : %f\n", f1); f1 = acosh (0.0); fprintf( stdout, "acosh : %f\n", f1); f1 = asin (1.0); fprintf( stdout, "asin : %f\n", f1); f1 = asinh (1.0); fprintf( stdout, "asinh : %f\n", f1); f1 = atan (M_PI_4); fprintf( stdout, "atan : %f\n", f1); f1 = atan2 (2.3, 2.3); fprintf( stdout, "atan2 : %f\n", f1); f1 = atanh (1.0); fprintf( stdout, "atanh : %f\n", f1); f1 = cbrt (27.0); fprintf( stdout, "cbrt : %f\n", f1); f1 = ceil (3.5); fprintf( stdout, "ceil : %f\n", f1); f1 = copysign (3.5, -2.5); fprintf( stdout, "copysign : %f\n", f1); f1 = cos (M_PI_2); fprintf( stdout, "cos : %f\n", f1); f1 = cosh (M_PI_2); fprintf( stdout, "cosh : %f\n", f1); f1 = erf (42.0); fprintf( stdout, "erf : %f\n", f1); f1 = erfc (42.0); fprintf( stdout, "erfc : %f\n", f1); f1 = exp (0.42); fprintf( stdout, "exp : %f\n", f1); f1 = exp2 (0.42); fprintf( stdout, "exp2 : %f\n", f1); f1 = expm1 (0.00042); fprintf( stdout, "expm1 : %f\n", f1); f1 = fabs (-1.123); fprintf( stdout, "fabs : %f\n", f1); f1 = fdim (1.123, 2.123); fprintf( stdout, "fdim : %f\n", f1); f1 = floor (0.5); fprintf( stdout, "floor : %f\n", f1); f1 = floor (-0.5); fprintf( stdout, "floor : %f\n", f1); f1 = fma (2.1, 2.2, 3.01); fprintf( stdout, "fma : %f\n", f1); f1 = fmax (-0.42, 0.42); fprintf( stdout, "fmax : %f\n", f1); f1 = fmin (-0.42, 0.42); fprintf( stdout, "fmin : %f\n", f1); f1 = fmod (42.0, 3.0); fprintf( stdout, "fmod : %f\n", f1); /* no type-specific variant */ i1 = fpclassify(1.0); fprintf( stdout, "fpclassify : %d\n", i1); f1 = frexp (42.0, &i1); fprintf( stdout, "frexp : %f\n", f1); f1 = hypot (42.0, 42.0); fprintf( stdout, "hypot : %f\n", f1); i1 = ilogb (42.0); fprintf( stdout, "ilogb : %d\n", i1); /* no type-specific variant */ i1 = isfinite(3.0); fprintf( stdout, "isfinite : %d\n", i1); /* no type-specific variant */ i1 = isgreater(3.0, 3.1); fprintf( stdout, "isgreater : %d\n", i1); /* no type-specific variant */ i1 = isgreaterequal(3.0, 3.1); fprintf( stdout, "isgreaterequal : %d\n", i1); /* no type-specific variant */ i1 = isinf(3.0); fprintf( stdout, "isinf : %d\n", i1); /* no type-specific variant */ i1 = isless(3.0, 3.1); fprintf( stdout, "isless : %d\n", i1); /* no type-specific variant */ i1 = islessequal(3.0, 3.1); fprintf( stdout, "islessequal : %d\n", i1); /* no type-specific variant */ i1 = islessgreater(3.0, 3.1); fprintf( stdout, "islessgreater : %d\n", i1); /* no type-specific variant */ i1 = isnan(0.0); fprintf( stdout, "isnan : %d\n", i1); /* no type-specific variant */ i1 = isnormal(3.0); fprintf( stdout, "isnormal : %d\n", i1); /* no type-specific variant */ f1 = isunordered(1.0, 2.0); fprintf( stdout, "isunordered : %d\n", i1); f1 = j0 (1.2); fprintf( stdout, "j0 : %f\n", f1); f1 = j1 (1.2); fprintf( stdout, "j1 : %f\n", f1); f1 = jn (2,1.2); fprintf( stdout, "jn : %f\n", f1); f1 = ldexp (1.2,3); fprintf( stdout, "ldexp : %f\n", f1); f1 = lgamma (42.0); fprintf( stdout, "lgamma : %f\n", f1); f1 = llrint (-0.5); fprintf( stdout, "llrint : %f\n", f1); f1 = llrint (0.5); fprintf( stdout, "llrint : %f\n", f1); f1 = llround (-0.5); fprintf( stdout, "lround : %f\n", f1); f1 = llround (0.5); fprintf( stdout, "lround : %f\n", f1); f1 = log (42.0); fprintf( stdout, "log : %f\n", f1); f1 = log10 (42.0); fprintf( stdout, "log10 : %f\n", f1); f1 = log1p (42.0); fprintf( stdout, "log1p : %f\n", f1); f1 = log2 (42.0); fprintf( stdout, "log2 : %f\n", f1); f1 = logb (42.0); fprintf( stdout, "logb : %f\n", f1); f1 = lrint (-0.5); fprintf( stdout, "lrint : %f\n", f1); f1 = lrint (0.5); fprintf( stdout, "lrint : %f\n", f1); f1 = lround (-0.5); fprintf( stdout, "lround : %f\n", f1); f1 = lround (0.5); fprintf( stdout, "lround : %f\n", f1); f1 = modf (42.0,&f2); fprintf( stdout, "lmodf : %f\n", f1); f1 = nan (""); fprintf( stdout, "nan : %f\n", f1); f1 = nearbyint (1.5); fprintf( stdout, "nearbyint : %f\n", f1); f1 = nextafter (1.5,2.0); fprintf( stdout, "nextafter : %f\n", f1); f1 = pow (3.01, 2.0); fprintf( stdout, "pow : %f\n", f1); f1 = remainder (3.01,2.0); fprintf( stdout, "remainder : %f\n", f1); f1 = remquo (29.0,3.0,&i1); fprintf( stdout, "remquo : %f\n", f1); f1 = rint (0.5); fprintf( stdout, "rint : %f\n", f1); f1 = rint (-0.5); fprintf( stdout, "rint : %f\n", f1); f1 = round (0.5); fprintf( stdout, "round : %f\n", f1); f1 = round (-0.5); fprintf( stdout, "round : %f\n", f1); f1 = scalbln (1.2,3); fprintf( stdout, "scalbln : %f\n", f1); f1 = scalbn (1.2,3); fprintf( stdout, "scalbn : %f\n", f1); /* no type-specific variant */ i1 = signbit(1.0); fprintf( stdout, "signbit : %i\n", i1); f1 = sin (M_PI_4); fprintf( stdout, "sin : %f\n", f1); f1 = sinh (M_PI_4); fprintf( stdout, "sinh : %f\n", f1); f1 = sqrt (9.0); fprintf( stdout, "sqrt : %f\n", f1); f1 = tan (M_PI_4); fprintf( stdout, "tan : %f\n", f1); f1 = tanh (M_PI_4); fprintf( stdout, "tanh : %f\n", f1); f1 = tgamma (2.1); fprintf( stdout, "tgamma : %f\n", f1); f1 = trunc (3.5); fprintf( stdout, "trunc : %f\n", f1); f1 = y0 (1.2); fprintf( stdout, "y0 : %f\n", f1); f1 = y1 (1.2); fprintf( stdout, "y1 : %f\n", f1); f1 = yn (3,1.2); fprintf( stdout, "yn : %f\n", f1); #endif }
double remquol( double x, double y, int *quo ) { return (double)remquo((double) x, (double) y, quo); }
__device__ void double_precision_math_functions() { int iX; double fX, fY; acos(1.0); acosh(1.0); asin(0.0); asinh(0.0); atan(0.0); atan2(0.0, 1.0); atanh(0.0); cbrt(0.0); ceil(0.0); copysign(1.0, -2.0); cos(0.0); cosh(0.0); cospi(0.0); cyl_bessel_i0(0.0); cyl_bessel_i1(0.0); erf(0.0); erfc(0.0); erfcinv(2.0); erfcx(0.0); erfinv(1.0); exp(0.0); exp10(0.0); exp2(0.0); expm1(0.0); fabs(1.0); fdim(1.0, 0.0); floor(0.0); fma(1.0, 2.0, 3.0); fmax(0.0, 0.0); fmin(0.0, 0.0); fmod(0.0, 1.0); frexp(0.0, &iX); hypot(1.0, 0.0); ilogb(1.0); isfinite(0.0); isinf(0.0); isnan(0.0); j0(0.0); j1(0.0); jn(-1.0, 1.0); ldexp(0.0, 0); lgamma(1.0); llrint(0.0); llround(0.0); log(1.0); log10(1.0); log1p(-1.0); log2(1.0); logb(1.0); lrint(0.0); lround(0.0); modf(0.0, &fX); nan("1"); nearbyint(0.0); nextafter(0.0, 0.0); fX = 1.0; norm(1, &fX); norm3d(1.0, 0.0, 0.0); norm4d(1.0, 0.0, 0.0, 0.0); normcdf(0.0); normcdfinv(1.0); pow(1.0, 0.0); rcbrt(1.0); remainder(2.0, 1.0); remquo(1.0, 2.0, &iX); rhypot(0.0, 1.0); rint(1.0); fX = 1.0; rnorm(1, &fX); rnorm3d(0.0, 0.0, 1.0); rnorm4d(0.0, 0.0, 0.0, 1.0); round(0.0); rsqrt(1.0); scalbln(0.0, 1); scalbn(0.0, 1); signbit(1.0); sin(0.0); sincos(0.0, &fX, &fY); sincospi(0.0, &fX, &fY); sinh(0.0); sinpi(0.0); sqrt(0.0); tan(0.0); tanh(0.0); tgamma(2.0); trunc(0.0); y0(1.0); y1(1.0); yn(1, 1.0); }
long double remquol(long double x, long double y, int *quo) { return remquo(x, y, quo); }
long double remquol (long double x, long double y, int *quo) { return (long double) remquo( (double)x, (double)y, quo ); }