void
 TensorProductBasis<BASIS0,BASIS1>::apply_Tj(const int j, const V& x, V& y) const
 { 
   y = x;
   V z(x);
   apply_Mj(j0(), z, y);
   for (int k = j0()+1; k <= j; k++) {
     apply_Mj(k, y, z);
     y.swap(z);
   }
 }
Example #2
0
double
jn (int n, double x) 
{
  int i;
  
  if (n < 0)
    {
      n = -n;
      x = -x;
    }
  if (n == 0) 
    return j0(x);
  if (n == 1) 
    return j1(x);
  if (x == 0.0) 
    return 0.0;

  if (n <= x)
    {
      double a = j0(x), b = j1(x), tmp;

      for (i = 1; i < n; i++)
	{
	  tmp = b;
	  b = (2.0*i / x) * b - a;
	  a = tmp;
	}
      return b;
    }
  else	/* n > x */
    {
      double a, b, xsq, t, tmp;

      xsq = x*x;
      for (t=0, i=n+16; i > n; i--)
	t = xsq / (2.0*i - t);
      t = x / (2.0*n - t);
      a = t;
      b = 1.0;
      for (i = n - 1; i > 0; i--)
	{
	  tmp = b;
	  b = (2.0*i / x ) * b - a;
	  a = tmp;
	}
      return t*j0(x)/b;
    }
}
  TensorProductIndex<BASIS0,BASIS1>
  TensorProductBasis<BASIS0,BASIS1>::last_wavelet(const int j)
  {
    assert(j >= j0());
    return TensorProductIndex<BASIS0,BASIS1>(BASIS0::last_wavelet(j),
 					     BASIS1::last_wavelet(j));
  }
  TensorProductIndex<BASIS0,BASIS1>
  TensorProductBasis<BASIS0,BASIS1>::first_generator(const int j)
  {
    assert(j >= j0());
    return TensorProductIndex<BASIS0,BASIS1>(BASIS0::first_generator(j),
 					     BASIS1::first_generator(j));
  }
double TransformErrFunction::evaluateReprojErrInt()
{
    double reprojErr = 0;
    for(TransformSet::const_iterator ppTrans = transformSet_->begin(); ppTrans != transformSet_->end(); ppTrans++)
    {
        int j = ppTrans->first.im1Id();
        int k = ppTrans->first.im2Id();

        if(j != alignTo_ && k != alignTo_ && (j > minIdToRefine_ || k > minIdToRefine_))
        {
            IdPair j0(j, alignTo_);
            IdPair k0(k, alignTo_);
            const Transform * Tj0 = (*transformSet_)[j0]->transform();
            const Transform * Tk0 = (*transformSet_)[k0]->transform();

            const Transform * Tjk = ppTrans->second->transform();
            int inlierCount = ppTrans->second->correspondences().size();

            Transform * Tj0_from_jk = Tk0->accumulate(Tjk);
            reprojErr += getErr(Tj0, Tj0_from_jk, inlierCount);
            delete Tj0_from_jk;
        }
        /*else if(j != alignTo_ ) //Here ppTrans->first.second == alignTo_. Don't calc reproj err for identity!
        {
            const Transform * Tj0 = ppTrans->second->transform();
            reprojErr += getErr(Tj0);

        }*/
    }
    return reprojErr * scaleCost_; //scaleCost_ makes errors initially about 1
}
void Foam::equationReader::evalDimsJ0DimCheck
(
    const equationReader * eqnReader,
    const label index,
    const label i,
    const label storageOffset,
    label& storeIndex,
    dimensionSet& xDims,
    dimensionSet sourceDims
) const
{
    if
    (
        !xDims.dimensionless() && dimensionSet::debug
    )
    {
        WarningIn("equationReader::evalDimsJ0DimCheck")
            << "Dimension error thrown for operation ["
            << equationOperation::opName
            (
                operator[](index)[i].operation()
            )
            << "] in equation " << operator[](index).name()
            << ", given by:" << token::NL << token::TAB
            << operator[](index).rawText();
    }
    dimensionedScalar ds("temp", xDims, 0.0);
    xDims.reset(j0(ds).dimensions());
    operator[](index)[i].assignOpDimsFunction
    (
        &Foam::equationReader::evalDimsJ0
    );
}
 inline
 JLBasis::Index
 JLBasis::first_wavelet(const int j) const
 {
   assert(j >= j0());
   return JLIndex(j, 1, 0, 1);
 }
int main() {
    double x = 1.0;
    double y = 1.0;
    int i = 1;
    acosh(x);
    asinh(x);
    atanh(x);
    cbrt(x);
    expm1(x);
    erf(x);
    erfc(x);
    isnan(x);
    j0(x);
    j1(x);
    jn(i,x);
    ilogb(x);
    logb(x);
    log1p(x);
    rint(x);
    y0(x);
    y1(x);
    yn(i,x);
#   ifdef _THREAD_SAFE
    gamma_r(x,&i);
    lgamma_r(x,&i);
#   else
    gamma(x);
    lgamma(x);
#   endif
    hypot(x,y);
    nextafter(x,y);
    remainder(x,y);
    scalb(x,y);
    return 0;
}
 inline
 JLBasis::Index
 JLBasis::last_wavelet(const int j) const
 {
   assert(j >= j0());
   return JLIndex(j, 1, 1, 1<<j);
 }
 inline
 JLBasis::Index
 JLBasis::last_generator(const int j) const
 {
   assert(j >= j0());
   return JLIndex(j, 0, 1, 1<<j);
 }
Example #11
0
double
Date::getYearDaysNum( double myY )
{
    Julian j1(date2Julian( myY+1., 1., 1., 0.) );
    Julian j0(date2Julian( myY, 1., 1., 0.) );

    return static_cast<double>( j1.jdn - j0.jdn ) ;
}
Example #12
0
double y0(double x)
{
	double z,s,c,ss,cc,u,v;
	int32_t hx,ix,lx;

	EXTRACT_WORDS(hx, lx, x);
	ix = 0x7fffffff & hx;
	/* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0  */
	if (ix >= 0x7ff00000)
		return 1.0/(x+x*x);
	if ((ix|lx) == 0)
		return -1.0/0.0;
	if (hx < 0)
		return 0.0/0.0;
	if (ix >= 0x40000000) {  /* |x| >= 2.0 */
		/* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
		 * where x0 = x-pi/4
		 *      Better formula:
		 *              cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
		 *                      =  1/sqrt(2) * (sin(x) + cos(x))
		 *              sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
		 *                      =  1/sqrt(2) * (sin(x) - cos(x))
		 * To avoid cancellation, use
		 *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
		 * to compute the worse one.
		 */
		s = sin(x);
		c = cos(x);
		ss = s-c;
		cc = s+c;
		/*
		 * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
		 * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
		 */
		if (ix < 0x7fe00000) {  /* make sure x+x does not overflow */
			z = -cos(x+x);
			if (s*c < 0.0)
				cc = z/ss;
			else
				ss = z/cc;
		}
		if (ix > 0x48000000)
			z = (invsqrtpi*ss)/sqrt(x);
		else {
			u = pzero(x);
			v = qzero(x);
			z = invsqrtpi*(u*ss+v*cc)/sqrt(x);
		}
		return z;
	}
	if (ix <= 0x3e400000) {  /* x < 2**-27 */
		return u00 + tpi*log(x);
	}
	z = x*x;
	u = u00+z*(u01+z*(u02+z*(u03+z*(u04+z*(u05+z*u06)))));
	v = 1.0+z*(v01+z*(v02+z*(v03+z*v04)));
	return u/v + tpi*(j0(x)*log(x));
}
Example #13
0
void main()
  {
     double x, y, z;

     x = j0( 2.4 );
     y = y1( 1.58 );
     z = jn( 3, 2.4 );
     printf( "j0(2.4) = %f, y1(1.58) = %f\n", x, y );
     printf( "jn(3,2.4) = %f\n", z );
  }
Example #14
0
double
Date::getDayOfTheYear(double y, double mo, double d,
                      double h, double mi, double s)
{
    double deciH = h + mi/60. + s/3600. ;
    Julian j0(date2Julian( y, 1., 1., 0.) );
    Julian j1(date2Julian( y, mo, d, deciH) );

    // the 1st of Jan, etc.!
    return ( static_cast<double>( j1.jdn - j0.jdn ) + 1. ) ;
}
Example #15
0
int main()
{
float y;
int i;

for (i = 0; i< 20; i++)
  {
    y = j0(z[i]);
    printf("%.9e\n", y);
  }
exit(0);
}
Example #16
0
complex<double> CUniformDisk::GetVis(pair<double,double> & uv)
{
	double radius = MasToRad(mRadius);
	// Calculate the visibility and return
	double baseline = sqrt(uv.first * uv.first + uv.second * uv.second);
	double phi = -2 * PI * (mAlpha * uv.first + mDelta * uv.second);
	double bess = PI * radius * baseline;

	complex<double> phase(cos(phi), sin(phi));
	double V = 2 * j0(bess)/bess;
	return V * phase;
}
Example #17
0
double 
y0 (double x)
{
  if (x < 0.0)
    return (dzero/dzero);	/* IEEE machines: invalid operation */
  if (x < 8.0)
    return yzero(x) + TWO_ON_PI * j0(x) * log(x);
  else
    return (sqrt (TWO_ON_PI/x) 
	    * (pzero(x) * sin (x - PI_ON_FOUR) 
	       + (8.0/x) * qzero(x) * cos(x - PI_ON_FOUR)));

}
void Foam::equationReader::evalScalarFieldJ0
(
    const equationReader * eqnReader,
    const label index,
    const label i,
    const label storageOffset,
    label& storeIndex,
    scalarField& x,
    const scalarField& source
) const
{
    j0(x, x);
}
  void
  TensorProductBasis<BASIS0,BASIS1>::apply_Tjinv(const int j, const V& x, V& y) const
  { 
    // T_j^{-1}=diag(G_{j0},I)*...*diag(G_{j-1},I)*G_j
    V z(x);
    apply_Gj(j, x, y);
    for (int k = j-1; k >= j0(); k--) {
      z.swap(y);
      apply_Gj(k, z, y);
      for (int i = Deltasize(k+1); i < Deltasize(j+1); i++)
	y[i] = z[i];
    }
  }
Example #20
0
File: y0.hpp Project: Quanteek/nt2
 template < class AA0 > static inline AA0 branch1(const AA0 & a0)
 {
   typedef typename meta::scalar_of<AA0>::type sAA0; 
   AA0 z = sqr(a0); 
   AA0 p2 = (z-single_constant<AA0, 0x3edd4b3a> ())*
   horner< NT2_HORNER_COEFF_T(sAA0, 5,
                      (0x33cb0920, 
                       0xb71ded71, 
                       0x3a0c1a3e, 
                       0xbc81c8f4, 
                       0x3e2edb4f
                       ) ) > (z);
   return p2+single_constant<AA0, 0x3f22f983>()*log(a0)*j0(a0);
 }
Example #21
0
File: j0.c Project: CoryXie/nix-os
double
y0(double arg)
{
	double argsq, n, d;
	int i;

	errno = 0;
	if(arg <= 0) {
		errno = EDOM;
		return(-HUGE_VAL);
	}
	if(arg > 8) {
		asympt(arg);
		n = arg - pio4;
		return sqrt(tpi/arg)*(pzero*sin(n) + qzero*cos(n));
	}
	argsq = arg*arg;
	for(n=0,d=0,i=8;i>=0;i--) {
		n = n*argsq + p4[i];
		d = d*argsq + q4[i];
	}
	return n/d + tpi*j0(arg)*log(arg);
}
Example #22
0
double
Date::getMonthDaysNum( double myMon, double myY )
{
    if( currCalendarEnum == EQUAL_MONTHS )
        return 30. ;

    int  mon = static_cast<int>( myMon );
    double t = regularMonthDays[mon-1] ;

    bool is = currCalendarEnum == GREGORIAN
              || currCalendarEnum == PROLEPTIC_GREGORIAN ;

    if( mon == 2 && is )
    {
        Julian j1(date2Julian( myY, myMon +1., 1., 0.) );
        Julian j0(date2Julian( myY, myMon    , 1., 0.) );

        long double tld= j1.jdn - j0.jdn  ;
        tld += (j1.time -j0.time) ;
        t = static_cast<double>( static_cast<int>(tld+0.5) );
    }

    return t ;
}
Example #23
0
double jv(double n, double x)
{
    double k, q, t, y, an;
    int i, sign, nint;

    nint = 0;			/* Flag for integer n */
    sign = 1;			/* Flag for sign inversion */
    an = fabs(n);
    y = floor(an);
    if (y == an) {
        nint = 1;
        i = an - 16384.0 * floor(an / 16384.0);
        if (n < 0.0) {
            if (i & 1)
                sign = -sign;
            n = an;
        }
        if (x < 0.0) {
            if (i & 1)
                sign = -sign;
            x = -x;
        }
        if (n == 0.0)
            return (j0(x));
        if (n == 1.0)
            return (sign * j1(x));
    }

    if ((x < 0.0) && (y != an)) {
        mtherr("Jv", DOMAIN);
        y = NPY_NAN;
        goto done;
    }

    if (x == 0 && n < 0 && !nint) {
        mtherr("Jv", OVERFLOW);
        return NPY_INFINITY / gamma(n + 1);
    }

    y = fabs(x);

    if (y * y < fabs(n + 1) * MACHEP) {
        return pow(0.5 * x, n) / gamma(n + 1);
    }

    k = 3.6 * sqrt(y);
    t = 3.6 * sqrt(an);
    if ((y < t) && (an > 21.0))
        return (sign * jvs(n, x));
    if ((an < k) && (y > 21.0))
        return (sign * hankel(n, x));

    if (an < 500.0) {
        /* Note: if x is too large, the continued fraction will fail; but then the
         * Hankel expansion can be used. */
        if (nint != 0) {
            k = 0.0;
            q = recur(&n, x, &k, 1);
            if (k == 0.0) {
                y = j0(x) / q;
                goto done;
            }
            if (k == 1.0) {
                y = j1(x) / q;
                goto done;
            }
        }

        if (an > 2.0 * y)
            goto rlarger;

        if ((n >= 0.0) && (n < 20.0)
                && (y > 6.0) && (y < 20.0)) {
            /* Recur backwards from a larger value of n */
rlarger:
            k = n;

            y = y + an + 1.0;
            if (y < 30.0)
                y = 30.0;
            y = n + floor(y - n);
            q = recur(&y, x, &k, 0);
            y = jvs(y, x) * q;
            goto done;
        }

        if (k <= 30.0) {
            k = 2.0;
        }
        else if (k < 90.0) {
            k = (3 * k) / 4;
        }
        if (an > (k + 3.0)) {
            if (n < 0.0)
                k = -k;
            q = n - floor(n);
            k = floor(k) + q;
            if (n > 0.0)
                q = recur(&n, x, &k, 1);
            else {
                t = k;
                k = n;
                q = recur(&t, x, &k, 1);
                k = t;
            }
            if (q == 0.0) {
underf:
                y = 0.0;
                goto done;
            }
        }
        else {
            k = n;
            q = 1.0;
        }

        /* boundary between convergence of
         * power series and Hankel expansion
         */
        y = fabs(k);
        if (y < 26.0)
            t = (0.0083 * y + 0.09) * y + 12.9;
        else
            t = 0.9 * y;

        if (x > t)
            y = hankel(k, x);
        else
            y = jvs(k, x);
#if CEPHES_DEBUG
        printf("y = %.16e, recur q = %.16e\n", y, q);
#endif
        if (n > 0.0)
            y /= q;
        else
            y *= q;
    }

    else {
        /* For large n, use the uniform expansion or the transitional expansion.
         * But if x is of the order of n**2, these may blow up, whereas the
         * Hankel expansion will then work.
         */
        if (n < 0.0) {
            mtherr("Jv", TLOSS);
            y = NPY_NAN;
            goto done;
        }
        t = x / n;
        t /= n;
        if (t > 0.3)
            y = hankel(n, x);
        else
            y = jnx(n, x);
    }

done:
    return (sign * y);
}
Example #24
0
 double operator()(double k) const
 { return k*std::exp(-std::pow(k, 5./3.))*j0(k*_r); }
Example #25
0
double besj0_ (const real *x) {
    return j0 (*x);
}
Example #26
0
double dbesj0_ (const double *x) {
    return j0 (*x);
}
Example #27
0
void test_extract() {
    int counts = 0;
    tbb::flow::tuple<int,int> dont_care;
    tbb::flow::graph g;
    typedef tbb::flow::source_node<int> snode_type;
    tbb::flow::source_node<int> s0(g, source_body<int>(counts), /*is_active*/false ); 
    tbb::flow::join_node< tbb::flow::tuple<int,int>, tbb::flow::reserving > j0(g);
    tbb::flow::join_node< tbb::flow::tuple<int,int>, tbb::flow::reserving > j1(g);
    tbb::flow::join_node< tbb::flow::tuple<int,int>, tbb::flow::reserving > j2(g);
    tbb::flow::queue_node<int> q0(g);
    tbb::flow::queue_node<tbb::flow::tuple<int,int> > q1(g);
    tbb::flow::make_edge(s0, tbb::flow::get<0>(j0.input_ports()));
    /*  s0 ----+    */
    /*         | j0 */
    /*         +    */
    ASSERT(!counts, "source_node activated too soon");
    s0.activate();
    g.wait_for_all();  // should produce one value, buffer it.
    ASSERT(counts == 1, "source_node did not react to activation");

    g.reset(tbb::flow::rf_reset_bodies);
    counts = 0;
    s0.extract();
    /*  s0     +    */
    /*         | j0 */
    /*         +    */
    s0.activate();
    g.wait_for_all();  // no successors, so the body will not execute
    ASSERT(counts == 0, "source_node shouldn't forward (no successors)");
    s0.extract(tbb::flow::rf_reset_bodies);

    tbb::flow::make_edge(s0, tbb::flow::get<0>(j0.input_ports()));
    tbb::flow::make_edge(s0, tbb::flow::get<0>(j1.input_ports()));
    tbb::flow::make_edge(s0, tbb::flow::get<0>(j2.input_ports()));

    /*        /+    */
    /*       / | j0 */
    /*      /  +    */
    /*     /        */
    /*    / /--+    */
    /*  s0-/   | j1 */
    /*    \    +    */
    /*     \        */
    /*      \--+    */
    /*         | j2 */
    /*         +    */

    // do all joins appear in successor list?
    std::vector<tbb::flow::receiver<int>*> jv1;
    jv1.push_back(&(tbb::flow::get<0>(j0.input_ports())));
    jv1.push_back(&(tbb::flow::get<0>(j1.input_ports())));
    jv1.push_back(&(tbb::flow::get<0>(j2.input_ports())));
    tbb::flow::source_node<int>::successor_vector_type sv;
    s0.copy_successors(sv);
    ASSERT(lists_match(sv, jv1), "mismatch in successor list");

    tbb::flow::make_edge(q0, tbb::flow::get<1>(j2.input_ports()));
    tbb::flow::make_edge(j2, q1);
    s0.activate();

    /*        /+           */
    /*       / | j0        */
    /*      /  +           */
    /*     /               */
    /*    / /--+           */
    /*  s0-/   | j1        */
    /*    \    +           */
    /*     \               */
    /*      \--+           */
    /*         | j2----q1  */
    /*  q0-----+           */

    q0.try_put(1);
    g.wait_for_all();
    ASSERT(q1.try_get(dont_care), "join did not emit result");
    j2.extract();
    tbb::flow::make_edge(q0, tbb::flow::get<1>(j2.input_ports()));
    tbb::flow::make_edge(j2, q1);

    /*        /+           */
    /*       / | j0        */
    /*      /  +           */
    /*     /               */
    /*    / /--+           */
    /*  s0-/   | j1        */
    /*         +           */
    /*                     */
    /*         +           */
    /*         | j2----q1  */
    /*  q0-----+           */

    jv1.clear();
    jv1.push_back(&(tbb::flow::get<0>(j0.input_ports())));
    jv1.push_back(&(tbb::flow::get<0>(j1.input_ports())));
    s0.copy_successors(sv);
    ASSERT(lists_match(sv, jv1), "mismatch in successor list");

    q0.try_put(1);
    g.wait_for_all();
    ASSERT(!q1.try_get(dont_care), "extract of successor did not remove pred link");

    s0.extract();

    /*         +           */
    /*         | j0        */
    /*         +           */
    /*                     */
    /*         +           */
    /*  s0     | j1        */
    /*         +           */
    /*                     */
    /*         +           */
    /*         | j2----q1  */
    /*  q0-----+           */

    ASSERT(s0.successor_count() == 0, "successor list not cleared");
    s0.copy_successors(sv);
    ASSERT(sv.size() == 0, "non-empty successor list");

    tbb::flow::make_edge(s0, tbb::flow::get<0>(j2.input_ports()));

    /*         +           */
    /*         | j0        */
    /*         +           */
    /*                     */
    /*         +           */
    /*  s0     | j1        */
    /*    \    +           */
    /*     \               */
    /*      \--+           */
    /*         | j2----q1  */
    /*  q0-----+           */

    jv1.clear();
    jv1.push_back(&(tbb::flow::get<0>(j2.input_ports())));
    s0.copy_successors(sv);
    ASSERT(lists_match(sv, jv1), "mismatch in successor list");

    q0.try_put(1);
    g.wait_for_all();
    ASSERT(!q1.try_get(dont_care), "extract of successor did not remove pred link");
}
Example #28
0
double eval(stack * stk, stack1 * no)
{

        stack1 nos = NULL;
        double x, y, z;
        char ch;
        ldiv_t ldivt;
        while (!empty(*stk)) {
                *stk = pop(*stk, &ch);
                if (ch == 'N') {
                        *no = pop1(*no, &x);
                        nos = push1(nos, x);
                } else if (ch == (char)0xD8) {
                } else {
                        nos = pop1(nos, &y);
                        if ((ch >= (char)0xA2 && ch <= (char)0xCA) && ch != (char)0xAA && ch != (char)0xCB
                            && ch != (char)0xB9)
                                x = 0;
                        else
                                nos = pop1(nos, &x);

                        switch (ch) {
                        case '+':
                                z = add(x, y);
                                break;
                        case '-':
                                z = dif(x, y);
                                break;
                        case '*':
                                z = mul(x, y);
                                break;

                        case '/':
                                if (y == 0.0) {
                                        eqp_errno = 6;
                                        return (0);
                                }
                                z = divide(x, y);
                                break;
                        case '^':
                                z = pow(x, y);
                                break;
                        case '%':
                                z = mod(x, y);
                                break;

                                /* The inline comments give the equivalent 
                                 * gnuplot function 
                                 */
                        case (char)0xA2:      /* abs(x) */
                                z = fabs(y);
                                break;
                        case (char)0xA3:      /* acos(x) */
                                if (y > 1 || y < -1) {
                                        /*
                                           eqp_errno = 9 ;
                                           return(0);
                                         */
                                }
                                z = acos(y);
                                break;
                        case (char)0xA4:      /* acosh(x) */
                                z = acosh(y);
                                break;
                        case (char)0xA6:      /* asin(x) */
                                if (y > 1 || y < -1) {
                                        /*
                                           eqp_errno = 10 ;
                                           return(0);
                                         */
                                }
                                z = asin(y);
                                break;
                        case (char)0xA7:      /* asinh(x) */
                                z = asinh(y);
                                break;
                        case (char)0xA8:      /* atan(x) */
                                z = atan(y);
                                break;
                        case (char)0xA9:      /* atanh(x) */
                                if (y > 1 || y < -1) {
                                        eqp_errno = 11;
                                        return (0);
                                }
                                z = atanh(y);
                                break;
                        case (char)0xAA:      /* atan2(y,x) */
                                z = atan2(x, y);
                                break;
                        case (char)0xAB:      /* besj0(x) */
                                z = j0(y);
                                break;
                        case (char)0xAC:      /* besj1(x) */
                                z = j1(y);
                                break;
                        case (char)0xAD:      /* besy0(x) */
                                if (y <= 0) {
                                        eqp_errno = 8;
                                        return (0);
                                }
                                z = y0(y);
                                break;
                        case (char)0xAE:      /* besy1(x) */
                                if (y <= 0) {
                                        eqp_errno = 18;
                                        return (0);
                                }
                                z = y1(y);
                                break;
                        case (char)0xAF:      /* ceil(x) */
                                z = ceil(y);
                                break;
                        case (char)0xB1:      /* cos(x) */
                                z = cos(y);
                                break;
                        case (char)0xB2:      /* cosh(x) */
                                z = cosh(y);
                                break;
                        case (char)0xCB:      /* div(num,denom) */
                                ldivt = ldiv((int) x, (int) y);
                                z = (double) ldivt.quot;
                                break;
                        case (char)0xB3:      /* erf(x) */
                                z = erf(y);
                                break;
                        case (char)0xB4:      /* erfc(x) */
                                z = erfc(y);
                                break;
                        case (char)0xB5:      /* exp(x) */
                                z = exp(y);
                                break;
                        case (char)0xB6:      /* floor(x) */
                                z = floor(y);
                                break;
                        case (char)0xB7:      /* gamma(x) */
                                z = exp(lgamma(y));
                                break;
                        case (char)0xBB:      /* int(x) */
                                z = rint(y);
                                if (z > 0 && z > y)
                                        z--;
                                if (z < 0 && z < y)
                                        z++;
                                break;
                        case (char)0xBC:      /* inverf(x) */
                                if (y <= -1 || y >= 1) {
                                        eqp_errno = 19;
                                        return (0);
                                }
                                z = inverf(y);
                                break;
                        case (char)0xBD:      /* invnorm(x) */
                                if (y <= 0 || y >= 1) {
                                        eqp_errno = 16;
                                        return (0);
                                }
                                z = sqrt(2) * inverf(2 * y - 1);
                                break;
                        case (char)0xBE:      /* lgamma(x) */
                                z = lgamma(y);
                                break;
                        case (char)0xBF:      /* log(x) */
                                if (y <= 0) {
                                        eqp_errno = 21;
                                        return (0);
                                }
                                z = log(y);
                                break;
                        case (char)0xC0:      /* log10(x) */
                                z = log10(y);
                                if (y <= 0) {
                                        eqp_errno = 20;
                                        return (0);
                                }
                                break;
                        case (char)0xC1:      /* norm(x) */
                                z = .5 * (1 + erf(y / sqrt(2)));
                                break;
                        case (char)0xC2:      /* rand(x) */
                                z = ((double) rand()) / RAND_MAX;
                                break;
                        case (char)0xC4:      /* sgn(x) */
                                if (y > 0)
                                        z = 1;
                                else if (y < 0)
                                        z = -1;
                                else
                                        z = 0;
                                break;
                        case (char)0xC5:      /* sin(x) */
                                z = sin(y);
                                break;
                        case (char)0xC6:      /* sinh(x) */
                                z = sinh(y);
                                break;
                        case (char)0xC7:      /* sqrt(x) */
                                z = sqrt(y);
                                break;
                        case (char)0xC8:      /* tan(x) */
                                z = tan(y);
                                break;
                        case (char)0xC9:      /* tanh(x) */
                                z = tanh(y);
                                break;
                        }
                        nos = push1(nos, z);
                }
        }
        nos = pop1(nos, &z);
#ifdef DEBUG
        printf("\n%lf", z);
#endif
        return (z);
}
Example #29
0
double
G77_dbesj0_0 (const double *x)
{
  return j0 (*x);
}
Example #30
0
float
G77_besj0_0 (const real * x)
{
  return (float) j0 ((double) *x);
}