JVM Knowledge

fmul

Raw .md Oracle

Operation

Multiply float

Format

fmul

Forms

fmul = 106 (0x6a)

Operand Stack

..., value1, value2 →

..., result

Description

Both value1 and value2 must be of type float. The values are popped from the operand stack. The float result is value1 * value2. The result is pushed onto the operand stack.

The result of an fmul instruction is governed by the rules of IEEE 754 arithmetic:

  • If either value1 or value2 is NaN, the result is NaN.
  • If neither value1 nor value2 is NaN, the sign of the result is positive if both values have the same sign, and negative if the values have different signs.
  • Multiplication of an infinity by a zero results in NaN.
  • Multiplication of an infinity by a finite value results in a signed infinity, with the sign-producing rule just given.
  • In the remaining cases, where neither an infinity nor NaN is involved, the product is computed and rounded to the nearest representable value using the round to nearest rounding policy (§2.8). If the magnitude is too large to represent as a float, we say the operation overflows; the result is then an infinity of appropriate sign. If the magnitude is too small to represent as a float, we say the operation underflows; the result is then a zero of appropriate sign.

The Java Virtual Machine requires support of gradual underflow. Despite the fact that overflow, underflow, or loss of precision may occur, execution of an fmul instruction never throws a run-time exception.