There are three types of operations that can be performed on floatingpoint numbers: 
1. unary,
2. binary,
3. and relational 


Unary operators act only on single floatingpoint numbers,
binary operators act on pairs of floatingpoint numbers.
Both unary and binary floatingpoint operators return floatingpoint results.
Relational operators, act on two floatingpoint numbers but return a boolean result.
Unary and binary floatingpoint operators return a float type if both operands are of type float. If one or both of the operands are of type double, however, the result of the operation is of type double. 



Unary FloatingPoint Operators 
The unary floating point operators act on a single floatingpoint number. Lists of the unary floatingpoint operators. 

The unary floatingpoint operators. 
Description 
Operator 
Increment 
++ 
Decrement 
 


The only two unary floatingpoint operators are the increment and decrement operators. These two operators respectively add and subtract 1.0 from their floatingpoint operand. 



Binary FloatingPoint Operators 
The binary floatingpoint operators act on a pair of floatingpoint numbers. Lists of the binary floatingpoint operators. 

The binary floatingpoint operators. 
Description 
Operator 
Addition 
+ 
Subtraction 
 
Multiplication 
* 
Division 
/ 
Modulus 
% 


The binary floatingpoint operators consist of the four traditional binary operations (+, , *, /), along with the modulus operator (%). 



The FloatMath class. 

class FloatMath
{
public static void main (String args[])
{
float x = 23.5F, y = 7.3F;
System.out.println("x = " + x);
System.out.println("y = " + y);
System.out.println("x + y = " + (x + y));
System.out.println("x  y = " + (x  y));
System.out.println("x * y = " + (x * y));
System.out.println("x / y = " + (x / y));
System.out.println("x % y = " + (x % y));
}
} 

The output of FloatMath follows: 

x = 23.5
y = 7.3
x + y = 30.8
x  y = 16.2
x * y = 171.55
x / y = 3.21918
x % y = 1.6
Output:

