public void testDoublesLargerThanLife() throws Exception {
  int iters=atLeast(100000);
  for (int i=0; i < iters; i++) {
    BigInteger unscaled=TestUtil.nextBigInteger(random(),42);
    int scale=TestUtil.nextInt(random(),-100,100);
    int precision=TestUtil.nextInt(random(),1,100);
    BigDecimal bigDecimal=new BigDecimal(unscaled,scale,new MathContext(precision,RoundingMode.HALF_EVEN));
    String encoded=bigDecimal.toString();
    double v=Double.parseDouble(encoded);
    checkDouble(v,encoded,1);
  }
}

public void testDoublesLargerThanLife ( ) throws Exception { int iters = atLeast ( 100000 ) ; for ( int i = 0 ; i < iters ; i ++ ) { BigInteger unscaled = TestUtil . nextBigInteger ( random ( ) , 42 ) ; int scale = TestUtil . nextInt ( random ( ) , - 100 , 100 ) ; int precision = TestUtil . nextInt ( random ( ) , 1 , 100 ) ; BigDecimal bigDecimal = new BigDecimal ( unscaled , scale , new MathContext ( precision , RoundingMode . HALF_EVEN ) ) ; String encoded = bigDecimal . toString ( ) ; double v = Double . parseDouble ( encoded ) ; checkDouble ( v , encoded , 1 ) ; } }
makes something like a random " database " fixed point double , tostring ' s it , and checks parsing . we check up to 100 digits for now .
