EXPRESSIONS
Remainder Operator
%
15.16.3
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 a zero, nor NaN is
involved, the quotient is computed. 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. If the magnitude is too small to represent, we say the
operation underflows and the result is then a zero of appropriate sign. Other 
wise, the quotient 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).
Despite the fact that overflow, underflow, division by zero, or loss of informa 
tion may occur, evaluation of a floating point division operator
/
 never throws a
run time exception.
15.16.3   Remainder Operator
%
And on the pedestal these words appear:
 My name is Ozymandias, king of kings:
Look on my works, ye Mighty, and despair! 
Nothing beside remains.
Percy Bysshe Shelley,
Ozymandias
(1817)
The binary
%
 operator is said to yield the remainder of its operands from an
implied division; the left hand operand is the dividend and the right hand operand
is the divisor.
In C and C++, the remainder operator accepts only integral operands, but in
Java, it also accepts floating point operands.
The remainder operation for operands that are integers after binary numeric
promotion ( 5.6.2) produces a result value such that
(a/b)*b+(a%b)
 is equal to
a
. This identity holds even in the special case that the dividend is the negative
integer of largest possible magnitude for its type and the divisor is
 1
 (the remain 
der is
0
). It follows from this rule that the result of the remainder operation can be
negative only if the dividend is negative, and can be positive only if the dividend is
positive; moreover, the magnitude of the result is always less than the magnitude
of the divisor. If the value of the divisor for an integer remainder operator is
0
,
then an
ArithmeticException
 is thrown.
353






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