posted 15 years ago
System.out.println(-9+"%"+-7+"="+-9%-7); // result -2
System.out.println(-7.6+"%"+-2.9+"="+7.6%2.9);// 1.7999999999999998
double d=-7.6;
double e=-2.9;
double f=d%e;
System.out.println(d+"%"+e+"="+f);//-1.7999999999999998
I understand that sign of result is of left operand, but when both operands are negative real numbers, result is +ve. Why?