52.

prev next contents
d2i

convert double to integer

Jasmin Syntax
     d2i 
Stack

Before

After
double-word1
integer-result
double-word2
...
...

Description

Pops a two-word double precision floating point number off of the operand stack, casts it into a 32-bit int, and pushes the resulting int onto the stack.

Rounding is done using IEEE 754 round-to-nearest mode. The fractional part is lost by rounding towards zero, so (int)-3.14 becomes -3.

If the original double value is NaN, the result is 0. If the value is too large to be represented as an integer, or if it is positive infinity, the result is the largest possible integer 0x7FFFFFFF. If the value is too small (i.e. a negative value of large magnitude, or negative infinity) then the result is the most negative integer 0x80000000.

Bytecode

Type

Description
u1
d2i opcode = 0x8E (142)
See Also

d2l, d2f


prev next contents
Java Virtual Machine, by Jon Meyer and Troy Downing, O'Reilly Associates


Java Virtual Machine
Java Virtual Machine (Java Series)
ISBN: 1565921941
EAN: 2147483647
Year: 1996
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net