Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ccccff
strictfp class WideSample {
  public static int subFloatFromInt(int op1, float op2)
                    throws ArithmeticException {

    // The significand can store at most 23 bits
    if ((op1op2 > 0x007fffff) || (op1op2 < -0x800000)) { 
      throw new ArithmeticException("Insufficient precision");
    }

    return op1 - (int)op2;
  }

  public static void main(String[] args) {
    int result = subFloatFromInt(1234567890, 1234567890);
    System.out.println(result);  
  }
}

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="beea9ff118ad4289-73693aca-4ba745ab-887bbb71-6d8fb9210148120a39f0933e"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. References#JLS 05]]

[§5.1.2, Widening Primitive Conversion

http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.2]

]]></ac:plain-text-body></ac:structured-macro>

...