Package java.math

Examples of java.math.BigDecimal.movePointRight()


                    b.movePointLeft(precision + 1);
                    if (String.valueOf(l).length() <= formatToken
                            .getPrecision()) {
                        precision++;
                    }
                    l = b.movePointRight(precision).longValue();
                    b.movePointLeft(precision);
                    if (l >= Math.pow(10, precision - 4)) {
                        formatToken.setPrecision(precision);
                    }
                }
View Full Code Here


    calendar.add( Calendar.SECOND,  (_seconds == null)
        ? 0 : addition ? _seconds.intValue() : 0 - _seconds.intValue());

    if(_seconds!=null) {
      BigDecimal fraction = _seconds.subtract(_seconds.setScale(0,BigDecimal.ROUND_DOWN));
      int millisec = fraction.movePointRight(3).intValue();
      calendar.add( Calendar.MILLISECOND, addition ? millisec : 0 - millisec);
    }
  }

  private static int parseInt(String value){
View Full Code Here

        calendar.add(Calendar.SECOND, getSeconds() * signum);

        if (seconds != null) {
            BigDecimal fraction =
                seconds.subtract(seconds.setScale(0, BigDecimal.ROUND_DOWN));
            int millisec = fraction.movePointRight(3).intValue();
            calendar.add(Calendar.MILLISECOND, millisec * signum);
        }
    }
   
    /**
 
View Full Code Here

        calendar.add(Calendar.SECOND, getSeconds() * signum);

        if (seconds != null) {
            BigDecimal fraction =
                seconds.subtract(seconds.setScale(0, BigDecimal.ROUND_DOWN));
            int millisec = fraction.movePointRight(3).intValue();
            calendar.add(Calendar.MILLISECOND, millisec * signum);
        }
    }

    /**
 
View Full Code Here

        }
        else{
            res=a_y.subtract(a_x);
        }
        int p=0;
        while(res.movePointRight(++p).compareTo(BigDecimal.ONE)<0);
        return p-1;
    }

    /***************************************
     *
 
View Full Code Here

                                           });
                throw new InvalidDatatypeValueException(msg);
            }
        }
        if ((fFacetsDefined & DatatypeValidator.FACET_TOTALDIGITS)!=0) {
            int totalDigits = d.movePointRight(d.scale()).toString().length() -
                              ((d.signum() < 0) ? 1 : 0); // account for minus sign
            if (totalDigits > fTotalDigits) {

                String msg = getErrorString(
                                           DatatypeMessageProvider.fgMessageKeys[DatatypeMessageProvider.TOTALDIGITS_EXCEEDED],
View Full Code Here

          Integer.valueOf(m.group(MIN_MG)));
      if (m.group(SEC_MG) != null) {
          BigDecimal sec = new BigDecimal(m.group(SEC_MG).substring(1));
          this.set(SECOND, sec.intValue());
          BigDecimal fraction = sec.subtract(sec.setScale(0, BigDecimal.ROUND_DOWN));
          int millisec = fraction.movePointRight(3).intValue();
          this.set(Calendar.MILLISECOND, millisec);
      }
     

      String tz = m.group(TZ_MG);
View Full Code Here

    calendar.add( Calendar.SECOND,  (_seconds == null)
        ? 0 : _seconds.intValue());
   
    if(_seconds!=null) {
      BigDecimal fraction = _seconds.subtract(_seconds.setScale(0,BigDecimal.ROUND_DOWN));
      int millisec = fraction.movePointRight(3).intValue();
      calendar.add( Calendar.MILLISECOND, millisec );
    }
  }
 
  private static int parseInt(String value){
View Full Code Here

                throw new InvalidDatatypeValueException(
                    getErrorString(DatatypeMessageProvider.ScaleExceeded,
                                   DatatypeMessageProvider.MSG_NONE,
                                   new Object[] { content }));
        if (fIsPrecision) {
            int precision = d.movePointRight(d.scale()).toString().length() -
                ((d.signum() < 0) ? 1 : 0); // account for minus sign
            if (precision > fPrecision)
                throw new InvalidDatatypeValueException(
                    getErrorString(DatatypeMessageProvider.PrecisionExceeded,
                                   DatatypeMessageProvider.MSG_NONE,
View Full Code Here

    } else { /* Small positive number: 0x16, ~-E, M */
      dst.put(POS_SMALL);
    }

    // normalize abs(val) to determine E
    while (abs.compareTo(EN10) < 0) { abs = abs.movePointRight(8); e += 4; }
    while (abs.compareTo(EN2) < 0) { abs = abs.movePointRight(2); e++; }

    putVaruint64(dst, e, !isNeg); // encode appropriate E value.

    // encode M by peeling off centimal digits, encoding x as 2x+1
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.