EXPRESSIONS
Shift Operators
15.18
say the operation overflows; the result is then an infinity of appropriate sign. If
the magnitude is too small to represent, we say the operation underflows; the
result is then a zero of appropriate sign. Otherwise, the sum is rounded to the
nearest representable value using IEEE 754 round to nearest mode. The Java
language requires support of gradual underflow as defined by IEEE 754
( 4.2.4).
The binary
 operator performs subtraction when applied to two operands of
numeric type producing the difference of its operands; the left hand operand is the
minuend and the right hand operand is the subtrahend. For both integer and float 
ing point subtraction, it is always the case that
a b
 produces the same result as
a+( b)
. Note that, for integer values, subtraction from zero is the same as nega 
tion. However, for floating point operands, subtraction from zero is
not
 the same
as negation, because if
x
 is
+0.0
, then
0.0 x
 equals
+0.0
, but
 x
 equals
 0.0
.
Despite the fact that overflow, underflow, or loss of information may occur,
evaluation of a numeric additive operator never throws a run time exception.
15.18   Shift Operators
What, I say, is to become of those wretches?
. . . What more can you say to them than  shift for yourselves? 
Thomas Paine,
 The American Crisis
 (1780)
The
shift operators
 include left shift
<<
, signed right shift
>>
, and unsigned right
shift
>>>
; they are syntactically left associative (they group left to right). The left 
hand operand of a shift operator is the value to be shifted; the right hand operand
specifies the shift distance.
ShiftExpression:
AdditiveExpression
ShiftExpression
 <<
AdditiveExpression
ShiftExpression
 >>
AdditiveExpression
ShiftExpression
 >>>
AdditiveExpression
The type of each of the operands of a shift operator must be a primitive inte 
gral type, or a compile time error occurs. Binary numeric promotion ( 5.6.2) is
not
 performed on the operands; rather, unary numeric promotion ( 5.6.1) is per 
formed on each operand separately. The type of the shift expression is the pro 
moted type of the left hand operand.
If the promoted type of the left hand operand is
int
, only the five lowest 
order bits of the right hand operand are used as the shift distance. It is as if the
359






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved