二項 / 演算子は除算を実行し、そのオペランドの商を生成します。左側のオペランドは被除数で、右側のオペランドは除数です。
整数除算は 0 に向かって丸めます。つまり、2 進数値昇格 (§5.6.2) 後の整数であるオペランド n と d に対して生成される商は、|d·q|| を満たしながら、大きさが可能な限り大きい整数値 q です。 n|; さらに、|n||d| の場合、q は正です。n と d は同じ符号ですが、|n||d| の場合、q は負です。n と d の符号は反対です。この規則を満たさない特殊なケースが 1 つあります。被除数がその型で可能な最大の大きさの負の整数で、除数が -1 の場合、整数オーバーフローが発生し、結果は被除数と等しくなります。この場合、オーバーフローがあっても例外はスローされません。一方、整数除算の除数の値が 0 の場合、ArithmeticException がスローされます。
浮動小数点除算の結果は、IEEE 演算の仕様によって決まります。
If either operand is NaN, the result is NaN.
If the result is not NaN, the sign of the result is positive if both operands have the same sign, negative if the operands have different signs.
Division of an infinity by an infinity results in NaN.
Division of an infinity by a finite value results in a signed infinity. The sign is determined by the rule stated above.
Division of a finite value by an infinity results in a signed zero. The sign is determined by the rule stated above.
Division of a zero by a zero results in NaN; division of zero by any other finite value results in a signed zero. The sign is determined by the rule stated above.
Division of a nonzero finite value by a zero results in a signed infinity. The sign is determined by the rule stated above.
In the remaining cases, where neither an infinity nor NaN is involved, the exact mathematical quotient is computed. A floating-point value set is then chosen:
If the division expression is FP-strict (§15.4):
If the type of the division expression is float, then the float value set must be chosen.
If the type of the division expression is double, then the double value set must be chosen.
If the division expression is not FP-strict:
If the type of the division expression is float, then either the float value set or the float-extended-exponent value set may be chosen, at the whim of the implementation.
If the type of the division expression is double, then either the double value set or the double-extended-exponent value set may be chosen, at the whim of the implementation.
Next, a value must be chosen from the chosen value set to represent the quotient. If the magnitude of the quotient is too large to represent, we say the operation overflows; the result is then an infinity of appropriate sign. Otherwise, the quotient is rounded to the nearest value in the chosen value set using IEEE 754 round-to-nearest mode. The Java programming language requires support of gradual underflow as defined by IEEE 754 (§4.2.4).
オーバーフロー、アンダーフロー、ゼロによる除算、または情報の損失が発生する可能性があるという事実にもかかわらず、浮動小数点除算演算子 / の評価で実行時例外がスローされることはありません。
これはhttp://docs.oracle.com/javase/specs/jls/se5.0/html/expressions.html#15.17.2で確認できます。