The left-hand operand is divided by the right-hand operand and the quotient is returned.

The left operand is the dividend, and the right is the divisor. ECMAScript compliant interpreters do not perform integer division. The operand and results of all divisions are double-precision floating point numbers. All divisions are performed according to IEEE 754 specifications.

If either operand is `NaN` then the result is `NaN`.

The sign of the result is positive if both operands have the same sign and negative if the operands have different signs.

Division of an infinity by an infinity results in `NaN`.

Division of an infinity by zero results in an infinity. The sign is determined by the rule stated earlier.

Division of infinity by a non-zero finite value results in a signed infinity. The sign is determined as before.

Division of a finite value by infinity results in zero. The sign is determined as usual.

Division of a zero by a zero results in `NaN`.

Division of zero by any other finite value results in zero with the sign determined as normal.

Otherwise, where there is neither an infinity or zero involved and neither value is `NaN`, the quotient is computed and rounded to the nearest representable value. If the magnitude is too large to represent, it will overflow and become an infinity. If the magnitude is too small to represent, an underflow occurs and the result will be zero.

The associativity is from left to right.

Refer to the operator precedence topic for details of execution order.

ECMA 262 edition 2 - section - 11.5.2

ECMA 262 edition 2 - section - 11.13

ECMA 262 edition 3 - section - 11.5.2

Prev | Home | Next |

DIV.align | Up | Divide then assign (/=) |

JavaScript Programmer's Reference, Cliff WoottonWrox Press (www.wrox.com)Join the Wrox JavaScript forum at p2p.wrox.comPlease report problems to support@wrox.com© 2001 Wrox Press. All Rights Reserved. Terms and conditions. |