Examples of toBigIntegerExact()


Examples of java.math.BigDecimal.toBigIntegerExact()

            CorruptIndexException e = new CorruptIndexException("failed to parse BigDecimal value (resource=" + in + ")");
            e.initCause(pe);
            throw e;
          }
          SimpleTextUtil.readLine(in, scratch); // read the line telling us if its real or not
          return BigInteger.valueOf(field.minValue).add(bd.toBigIntegerExact()).longValue();
        } catch (IOException ioe) {
          throw new RuntimeException(ioe);
        }
      }
    };
View Full Code Here

Examples of java.math.BigDecimal.toBigIntegerExact()

            return decimal.longValueExact();
        }
        catch (ArithmeticException e) {
        }
        try {
            return decimal.toBigIntegerExact();
        }
        catch (ArithmeticException e) {
        }
        return decimal.stripTrailingZeros();
    }
View Full Code Here

Examples of java.math.BigDecimal.toBigIntegerExact()

                else if (str.equals("b"))
                {
                    dec = dec.scaleByPowerOfTen(9);
                }
                super.remove(0, offset);
                String outcome = dec.toBigIntegerExact().toString();
                outcome = outcome.replace('.', decimalSeparator);
                super.insertString(0, outcome, a);
                fireUserInputChange();
            }
View Full Code Here

Examples of java.math.BigDecimal.toBigIntegerExact()

                        } catch (ArithmeticException ex) {
                            // No, it can not be converted to long

                            try {
                                // Can it be an integer
                                BigInteger bi = bd.toBigIntegerExact();
                                this.valueType = XSD_INTEGER;
                                this.value = bi;
                                this.isDecimal = false;
                            } catch (ArithmeticException ex1) {
                                // OK, its a decimal
View Full Code Here

Examples of java.math.BigDecimal.toBigIntegerExact()

            bd = (BigDecimal) decoder.parse(scratch.utf8ToString());
          } catch (ParseException pe) {
            throw new CorruptIndexException("failed to parse BigDecimal value (resource=" + in + ")", pe);
          }
          SimpleTextUtil.readLine(in, scratch); // read the line telling us if its real or not
          return BigInteger.valueOf(field.minValue).add(bd.toBigIntegerExact()).longValue();
        } catch (IOException ioe) {
          throw new RuntimeException(ioe);
        }
      }
    };
View Full Code Here

Examples of java.math.BigDecimal.toBigIntegerExact()

          } catch (ParseException pe) {
            CorruptIndexException e = new CorruptIndexException("failed to parse BigDecimal value (resource=" + in + ")");
            e.initCause(pe);
            throw e;
          }
          return BigInteger.valueOf(field.minValue).add(bd.toBigIntegerExact()).longValue();
        } catch (IOException ioe) {
          throw new RuntimeException(ioe);
        }
      }
    };
View Full Code Here

Examples of java.math.BigDecimal.toBigIntegerExact()

   */
  public void testToBigIntegerExact1() {
    String a = "-123809648392384754573567356745735.63567890295784902768787678287E+45";
    BigDecimal aNumber = new BigDecimal(a);
    String res = "-123809648392384754573567356745735635678902957849027687876782870000000000000000";
    BigInteger result = aNumber.toBigIntegerExact();
    assertEquals("incorrect value", res, result.toString());
  }

  /**
   * toBigIntegerExact().
 
View Full Code Here

Examples of java.math.BigDecimal.toBigIntegerExact()

   */
  public void testToBigIntegerExactException() {
    String a = "-123809648392384754573567356745735.63567890295784902768787678287E-10";
    BigDecimal aNumber = new BigDecimal(a);
    try {
      aNumber.toBigIntegerExact();
      fail("java.lang.ArithmeticException has not been thrown");
    } catch (java.lang.ArithmeticException e) {
      return;
    }
  }
View Full Code Here

Examples of java.math.BigDecimal.toBigIntegerExact()

      throw new IllegalArgumentException("Unknown currency pair " + pair);

    BigDecimal lots = order.getTradableAmount().multiply(lotMulti);
    if (lots.compareTo(BigDecimal.ONE) < 0)
      throw new IllegalArgumentException("Tradable amount too low");
    return lots.toBigIntegerExact();
  }

}
View Full Code Here

Examples of java.math.BigDecimal.toBigIntegerExact()

     */
    public void testToBigIntegerExact1() {
        String a = "-123809648392384754573567356745735.63567890295784902768787678287E+45";
        BigDecimal aNumber = new BigDecimal(a);
        String res = "-123809648392384754573567356745735635678902957849027687876782870000000000000000";
        BigInteger result = aNumber.toBigIntegerExact();
        assertEquals("incorrect value", res, result.toString());
    }

    /**
     * toBigIntegerExact()
 
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.