• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/ICU-531.30/icuSources/i18n/

Lines Matching refs:exponent

60 /*    precision (up to 999,999,999 digits) and arbitrary exponent     */
69 /* be finite, positive, have an exponent of zero, and all digits */
71 /* which are 0 or 1 (and will have exponent=0 and a sign of 0). */
136 /* 4. Exponent checking is minimized by allowing the exponent to */
141 /* overflow (the most negative valid exponent is -1999999997, for */
142 /* a 999999999-digit number with adjusted exponent of -999999999). */
398 /* Invalid is set if the decNumber does not have exponent==0 or if */
406 /* special or too many digits, or bad exponent */
407 if (dn->bits&DECSPECIAL || dn->digits>10 || dn->exponent!=0) ; /* bad */
441 /* special or too many digits, or bad exponent, or negative (<0) */
442 if (dn->bits&DECSPECIAL || dn->digits>10 || dn->exponent!=0
499 /* exponent (set.emax and set.emin), determining if */
504 /* The length of the coefficient and the size of the exponent are */
512 Int exponent=0; /* working exponent [assume 0] */
613 /* had some digits; exponent is only valid sequence now */
614 Flag nege; /* 1=negative exponent */
615 const char *firstexp; /* -> first significant exponent digit */
618 /* Found 'e' or 'E' -- now process explicit exponent */
627 firstexp=c; /* save exponent digit place */
630 exponent=X10(exponent)+(Int)*c-(Int)'0';
636 /* if it was too long the exponent may have wrapped, so check */
639 if (c>firstexp+9+1 || *firstexp>'1') exponent=DECNUMMAXE*2;
642 if (nege) exponent=-exponent; /* was negative */
667 exponent-=(last-dotchar); /* adjust exponent */
714 dn->exponent=exponent;
726 if ((dn->exponent-1<set->emin-dn->digits)
727 || (dn->exponent-1>set->emax-set->digits)) {
769 dzero.exponent=rhs->exponent; /* [no coefficient expansion] */
827 if (lhs->exponent!=0 || decNumberIsSpecial(lhs) || decNumberIsNegative(lhs)
828 || rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) {
868 res->exponent=0; /* integer */
1224 if (rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) {
1255 res->exponent=0; /* integer */
1331 /* decNumberLogB - get adjusted exponent, by 754 rules */
1340 /* an exponent of +999999999, or one digit and an exponent of */
1343 /* This returns the adjusted exponent of A after (in theory) padding */
1345 /* same value. The exponent is not limited by emin/emax. */
1371 Int ae=rhs->exponent+rhs->digits-1; /* adjusted exponent */
1405 /* requested digits and t is the number of digits in the exponent */
1419 Int t; /* digits in exponent of A */
1471 /* the exponent, conveniently, is the power of 10; making */
1475 uprv_decNumberFromInt32(w, w->exponent);
1484 /* number of digits in a, including exponent' as compared to the */
1669 dzero.exponent=rhs->exponent; /* [no coefficient expansion] */
1706 dtiny.exponent=DEC_MIN_EMIN-1; /* .. smaller than tiniest */
1743 dtiny.exponent=DEC_MIN_EMIN-1; /* .. smaller than tiniest */
1806 dtiny.exponent=DEC_MIN_EMIN-1; /* .. smaller than tiniest */
1843 if (lhs->exponent!=0 || decNumberIsSpecial(lhs) || decNumberIsNegative(lhs)
1844 || rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) {
1882 res->exponent=0; /* integer */
1912 dzero.exponent=rhs->exponent; /* [no coefficient expansion] */
2044 res->exponent=-shift; /* make 1.0000... */
2129 /* is the total digits, including exponent), or the requested */
2130 /* precision, if larger, + 4; 6 is used for the exponent */
2151 aset.digits=reqdigits+(rhs->digits+rhs->exponent)+2;
2184 dac->exponent=-shift; /* make 1.0000... */
2298 /* decNumberQuantize -- force exponent to requested value */
2301 /* of C (by rounding or shifting) such that the exponent (-scale) */
2302 /* of C has exponent of B. The numerical value of C will equal A, */
2307 /* rhs is B, the number with exponent to match */
2312 /* Unless there is an error or the result is infinite, the exponent */
2387 /* decNumberRescale -- force exponent to requested value */
2390 /* of C (by rounding or shifting) such that the exponent (-scale) */
2396 /* rhs is B, the requested exponent */
2401 /* Unless there is an error or the result is infinite, the exponent */
2471 /* the exponent or the sign of A. If lhs->digits is less than */
2496 else if (decNumberIsInfinite(rhs) || rhs->exponent!=0)
2617 else if (lhs->exponent==rhs->exponent) ret=1;
2641 Int reqexp; /* requested exponent change [B] */
2653 else if (decNumberIsInfinite(rhs) || rhs->exponent!=0)
2665 res->exponent+=reqexp; /* adjust the exponent */
2687 /* the exponent or the sign of A. */
2709 else if (decNumberIsInfinite(rhs) || rhs->exponent!=0)
2787 /* var e := getexp(x) % exponent part of x */
2794 /* approx := .0819 + 2.59 * f % exponent */
2822 /* result setexp(approx, e div 2) % fix exponent */
2838 Int exp; /* working exponent */
2839 Int ideal; /* ideal (preferred) exponent */
2891 /* calculate the ideal (preferred) exponent [floor(exp/2)] */
2892 /* [It would be nicer to write: ideal=rhs->exponent>>1, but this */
2894 ideal=(rhs->exponent&~1)/2; /* target */
2899 res->exponent=ideal; /* use the ideal [safe] */
2900 /* use decFinish to clamp any out-of-range exponent, etc. */
2942 /* copy rhs -> f, save exponent, and reduce so 0.1 <= f < 1 */
2944 exp=f->exponent+f->digits; /* adjusted to Hull rules */
2945 f->exponent=-(f->digits); /* to range */
2955 /* Calculate initial approximation, and allow for odd exponent */
2959 if ((exp & 1)==0) { /* even exponent */
2961 t->exponent=-3;
2962 a->exponent=-3;
2974 else { /* odd exponent */
2976 f->exponent--; /* f=f/10 */
2978 t->exponent=-4;
2979 a->exponent=-2;
3001 t->exponent=-1; /* .. */
3015 /* having the correct exponent so as to handle subnormals */
3019 a->exponent+=exp/2; /* set correct exponent */
3025 /* Overflow was possible if the input exponent was out-of-range, */
3037 a->exponent-=exp/2; /* back to 0.1->1 */
3045 t->exponent=-a->digits-1; /* make 0.5 ulp */
3052 t->exponent++; /* make 1.0 ulp */
3066 t->exponent++; /* make 1.0 ulp */
3079 a->exponent+=exp/2; /* set correct exponent */
3104 /* use closest exponent to ideal... */
3105 Int todrop=ideal-a->exponent; /* most that can be dropped */
3110 Int maxdrop=maxexp-a->exponent;
3121 a->exponent+=todrop; /* maintain numerical value */
3132 Int ae=rhs->exponent+rhs->digits-1; /* adjusted exponent */
3198 /* rescale(rhs, 0) if rhs->exponent is <0. */
3224 if (rhs->exponent>=0) return uprv_decNumberCopy(res, rhs);
3225 /* that was easy, but if negative exponent there is work to do... */
3229 uprv_decNumberZero(&dn); /* make a number with exponent 0 */
3273 if (lhs->exponent!=0 || decNumberIsSpecial(lhs) || decNumberIsNegative(lhs)
3274 || rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) {
3312 res->exponent=0; /* integer */
3394 dest->exponent=src->exponent;
3546 Int ae; /* adjusted exponent */
3554 ae=dn->exponent+dn->digits-1; /* adjusted exponent */
3566 Int ae; /* adjusted exponent */
3574 ae=dn->exponent+dn->digits-1; /* adjusted exponent */
3624 dn->exponent=0;
3651 Int exp=dn->exponent; /* local copy */
3700 /* non-0 exponent -- assume plain form */
3718 /* if dealing with zero still produce an exponent which is a */
3729 } /* need exponent */
3785 /* lay out the exponent [_itoa or equivalent is not ANSI C] */
3902 Int lexp=lhs->exponent; /* save in case LHS==RES */
3910 /* exponent will be the lower of the two */
3911 adjust=lexp-res->exponent; /* adjustment needed [if -ve] */
3913 if (adjust<0) res->exponent=lexp; /* set exponent */
3927 res->exponent+=adjust; /* set the exponent. */
3938 Int rexp=rhs->exponent; /* save in case RHS==RES */
3945 /* exponent will be the lower of the two */
3947 adjust=rexp-res->exponent; /* adjustment needed [if -ve] */
3954 res->exponent+=adjust; /* set the exponent. */
3966 padding=rhs->exponent-lhs->exponent;
3973 && rhs->exponent>=set->emin /* [some normals drop through] */
3974 && rhs->exponent<=set->emax-set->digits+1 /* [could clamp] */
4041 res->exponent-=shift; /* adjust the exponent. */
4082 res->exponent=lhs->exponent; /* .. operands (even if aliased) */
4236 /* exp=exp+1 -- set the proper exponent */
4281 Int exponent; /* working exponent */
4282 Int maxexponent=0; /* DIVIDE maximum exponent if unrounded */
4343 /* for DIVIDEINT the exponent is always 0. For DIVIDE, result */
4344 /* is a 0 with infinitely negative exponent, clamped to minimum */
4346 res->exponent=set->emin-set->digits+1;
4379 exponent=lhs->exponent-rhs->exponent; /* ideal exponent */
4382 res->exponent=exponent; /* exponent, too */
4383 decFinalize(res, set, &residue, status); /* check exponent */
4390 exponent=rhs->exponent; /* [save in case overwrite] */
4392 if (exponent<res->exponent) res->exponent=exponent; /* use lower */
4399 /* Precalculate exponent. This starts off adjusted (and hence fits */
4400 /* in 31 bits) and becomes the usual unadjusted exponent as the */
4403 exponent=(lhs->exponent+lhs->digits)-(rhs->exponent+rhs->digits);
4405 /* If the working exponent is -ve, then some quick exits are */
4408 if (exponent<0 && !(op==DIVIDE)) {
4417 /* (or equal) exponent */
4418 if (lhs->exponent<=rhs->exponent) {
4419 if (op&REMAINDER || exponent<-1) {
4498 /* but the exponent was calculated on the assumption that they are */
4499 /* both left-aligned. Adjust the exponent to compensate: add the */
4503 for (pow=&powers[1]; *msu1>=*pow; pow++) exponent--;
4504 for (pow=&powers[1]; *msu2>=*pow; pow++) exponent++;
4510 /* doing a remainder.) Also ensure the exponent is not negative. */
4516 if (exponent<0) cut=-exponent;
4517 else cut=DECDPUN-exponent%DECDPUN;
4519 exponent+=cut; /* maintain numerical value */
4525 maxexponent=lhs->exponent-rhs->exponent; /* save */
4530 exponent-=DECDPUN; /* update the exponent */
4620 if ((op&DIVIDE) && (exponent<=maxexponent)) break;
4625 if (exponent==0 && !(op&DIVIDE)) break;
4630 exponent-=DECDPUN; /* update the exponent */
4654 /* exponent is 'loose'. */
4661 if (exponent>=maxexponent) break; /* don't chop real 0s */
4668 exponent++;
4674 /* [exponent was adjusted in the loop] */
4682 if (accdigits+exponent>reqdigits) {
4687 /* [Here, the exponent will be 0, because var1 was adjusted */
4699 Int exp=lhs->exponent; /* save min(exponents) */
4700 if (rhs->exponent<exp) exp=rhs->exponent;
4705 res->exponent=exp; /* .. with proper exponent */
4719 postshift=var1initpad+exponent-lhs->exponent+rhs->exponent;
4720 /* [the 'exponent' term accounts for the shifts during divide] */
4729 exponent=lhs->exponent; /* exponent is smaller of lhs & rhs */
4730 if (rhs->exponent<exponent) exponent=rhs->exponent;
4747 /* RHS. The remainder's exponent may be smaller than the RHS's. */
4749 rhs->exponent-exponent);
4790 exp=rhs->exponent-exponent; /* RHS padding needed */
4791 /* Calculate units and remainder from exponent. */
4800 /* [exponent is as for original remainder] */
4807 /* Set exponent and bits */
4808 res->exponent=exponent;
4872 Int exponent; /* work */
5155 /* There can be a 31-bit wrap in calculating the exponent. */
5158 /* safe very negative exponent, from which decFinalize() will */
5160 exponent=lhs->exponent+rhs->exponent; /* calculate exponent */
5161 if (lhs->exponent<0 && rhs->exponent<0 && exponent>0)
5162 exponent=-2*DECNUMMAXE; /* force underflow */
5163 res->exponent=exponent; /* OK to overwrite now */
5265 Int h; /* adjusted exponent for 0.xxxx */
5324 /* exponent is such that if x is positive it will have */
5333 d->exponent=-set->digits; /* * 10**(-d) */
5334 if (decNumberIsNegative(rhs)) d->exponent--; /* negative case */
5344 res->exponent=-shift; /* make 1.0000... */
5356 /* calculate the adjusted (Hull & Abrham) exponent (where the */
5358 h=rhs->exponent+rhs->digits;
5370 if (decNumberIsNegative(rhs)) a->exponent=-2; /* make 0.02 */
5387 Int use=-rhs->digits-lever; /* exponent to use for RHS */
5394 if (rhs->exponent!=use) {
5405 newrhs->exponent=use; /* normalize; now <1 */
5478 if (((a->digits+a->exponent)>=(t->digits+t->exponent+p+1))
5540 /* exponent (e=the bottom 2 bits encoding 0-3) */
5677 if (rhs->exponent==0 && set->digits<=40) {
5737 r=rhs->exponent+rhs->digits; /* 'normalised' exponent */
5740 b->exponent=-6; /* .. */
5747 b->exponent=0; /* make integer */
5752 b->exponent=-(t&3)-3; /* set exponent */
5805 (a->digits+a->exponent)>=(b->digits+b->exponent+set->digits+1)) {
5809 if (cmp.lsu[0]==0) a->exponent=0; /* yes, exact 0 */
5814 if (decNumberIsZero(b)) b->exponent=a->exponent-p;
5852 /* decQuantizeOp -- force exponent to requested value */
5855 /* of C (by rounding or shifting) such that the exponent (-scale) */
5856 /* of C has the value B or matches the exponent of B. */
5862 /* rhs is B, the requested exponent */
5870 /* Unless there is an error or the result is infinite, the exponent */
5882 Int reqexp; /* requested exponent [-scale] */
5921 /* set requested exponent */
5922 if (quant) reqexp=inrhs->exponent; /* quantize -- match exponents */
5944 res->exponent=reqexp; /* .. just set exponent */
5950 Int adjust=reqexp-lhs->exponent; /* digit adjustment needed */
5957 if (adjust>0) { /* increasing exponent */
5967 /* If just rounded a 999s case, exponent will be off by one; */
5969 if (res->exponent>reqexp) {
5978 res->exponent--; /* (re)adjust the exponent. */
5984 else /* adjust<=0 */ { /* decreasing or = exponent */
5992 res->exponent+=adjust; /* adjust the exponent */
5999 if (res->exponent>set->emax-res->digits+1) { /* too big */
6141 if (lhs->exponent!=rhs->exponent) {
6142 if (lhs->exponent<rhs->exponent) result=-1;
6146 } /* total-order by exponent */
6159 /* choose according to sign then exponent (see 754) */
6174 if (lhs->exponent<rhs->exponent) result=+1;
6179 if (lhs->exponent>rhs->exponent) result=+1;
6244 if (lhs->exponent>rhs->exponent) { /* LHS exponent larger */
6253 rhs->exponent-lhs->exponent);
6263 /* B has an exponent of E (which must be non-negative) */
6314 /* Calculate units and remainder from exponent. */
6629 /* may be limited if the exponent is high. */
6647 dn->exponent=0; /* (sign is preserved) */
6652 exp=dn->exponent;
6681 Int maxd=set->emax-set->digits+1-dn->exponent;
6688 dn->exponent+=d; /* maintain numerical value */
6888 dest->exponent=src->exponent;
6920 /* dn->digits, dn->lsu (and as required), and dn->exponent are */
6952 /* dn->exponent and residue are unchanged, record any inexactitude */
6958 dn->exponent+=discard; /* maintain numerical value */
7100 /* coefficient constant. The exponent and status are unchanged */
7196 /* and adjust the exponent by one (as otherwise could overflow */
7209 dn->exponent++; /* and bump exponent */
7211 if ((dn->exponent+dn->digits)>set->emax+1) {
7235 dn->exponent--; /* and bump exponent */
7237 /* iff the number was at the subnormal boundary (exponent=etiny) */
7238 /* then the exponent is now out of range, so it will in fact get */
7241 /* dn->exponent, set->digits); */
7242 if (dn->exponent+1==set->emin-set->digits+1) {
7248 dn->exponent++;
7286 dn->exponent=0; /* clean exponent .. */
7290 if (dn->exponent>=0) { /* non-negative exponent */
7292 if (set->digits >= (dn->exponent+dn->digits)) {
7293 dn->digits=decShiftToMost(dn->lsu, dn->digits, dn->exponent);
7294 dn->exponent=0;
7322 /* Must be careful, here, when checking the exponent as the */
7323 /* adjusted exponent could overflow 31 bits [because it may already */
7328 if (dn->exponent<=tinyexp) { /* prefilter */
7332 if (dn->exponent<tinyexp) {
7340 nmin.exponent=set->emin;
7357 if (dn->exponent<=set->emax-set->digits+1) return; /* neither needed */
7361 if (dn->exponent>set->emax-dn->digits+1) { /* too big */
7368 /* here when need to apply the IEEE exponent clamp (fold-down) */
7369 shift=dn->exponent-(set->emax-set->digits+1);
7375 dn->exponent-=shift; /* adjust the exponent to match */
7398 if (dn->exponent>emax) { /* clamp required */
7399 dn->exponent=emax;
7451 dn->exponent=set->emax-set->digits+1;
7455 /* decSetSubnormal -- process value whose exponent is <Emin */
7465 /* Value may be zero with a low exponent; this does not set Subnormal */
7466 /* but the exponent will be clamped to Etiny. */
7468 /* Otherwise ensure exponent is not out of range, and round as */
7486 /* Full arithmetic -- allow subnormals, rounded to minimum exponent */
7488 etiny=set->emin-(set->digits-1); /* smallest allowed exponent */
7498 if (dn->exponent<etiny) { /* clamp required */
7499 dn->exponent=etiny;
7506 adjust=etiny-dn->exponent; /* calculate digits to remove */
7515 /* adjust>0, so need to rescale the result so exponent becomes Etiny */
7528 /* if rounded up a 999s case, exponent will be off by one; adjust */
7530 if (dn->exponent>etiny) {
7532 dn->exponent--; /* (re)adjust the exponent. */
7564 || rhs->exponent+rhs->digits>DEC_MAX_MATH+1
7565 || rhs->exponent+rhs->digits<2*(1-DEC_MAX_MATH))
7589 Int ilength=dn->digits+dn->exponent; /* integral length */
7600 if (ISZERO(dn)) return 0; /* zeros are OK, with any exponent */
7604 if (dn->exponent>=0) { /* relatively easy */
7605 /* no fractional part [usual]; allow for positive exponent */
7606 got=dn->exponent;
7608 else { /* -ve exponent; some fractional part to check and discard */
7609 Int count=-dn->exponent; /* digits to discard */
7764 res->exponent=0; /* clean exponent */
7852 /* Shows: sign, exponent, coefficient (msu first), digits */
7872 /* if coefficient and exponent are 0, no more to do */
7873 if (dn->exponent==0 && dn->digits==1 && *dn->lsu==0) {
7892 if (dn->exponent!=0) {
7894 if (dn->exponent<0) esign='-';
7895 printf(" E%c%ld", esign, (LI)abs(dn->exponent));
8014 if (dn->exponent!=0) {
8017 (LI)dn->exponent, dn->bits);
8069 /* check the exponent. Note that input operands can have exponents */
8072 ae=dn->exponent+dn->digits-1; /* adjusted exponent */
8078 printf("Adjusted exponent underflow [%ld].\n", (LI)ae);
8084 printf("Adjusted exponent overflow [%ld].\n", (LI)ae);