fork download
  1. import java.math.*;
  2.  
  3. class Test
  4. {
  5. public static void main (String[] args) throws java.lang.Exception
  6. {
  7. BigDecimal n = new BigDecimal("28823782170588812530601651539045955548");
  8. BigDecimal d = new BigDecimal("340282366920938463463374607431768211455");
  9. System.out.println("Test 1: " + n.divide(d, 8, RoundingMode.HALF_UP));
  10. System.out.println("Test 2: " + n.divide(d, 7, RoundingMode.HALF_UP));
  11. System.out.println("Test 3: " + n.divide(d, 6, RoundingMode.HALF_UP));
  12. System.out.println("Test 4: " + n.divide(d, 5, RoundingMode.HALF_UP));
  13. }
  14. }
Success #stdin #stdout 0.11s 320512KB
stdin
Standard input is empty
stdout
Test 1: 0.08470548
Test 2: 0.0847055
Test 3: 0.084705
Test 4: 0.08471