Can Somebody please tell me what is wrong. when I type the equations for low and high into a calculator I get low = 118.129 high = 113.629.
But for some reason both low and high are showing 119.0 when I run the code.
match_FRC = 82;//Double.parseDouble(FRC_match_textbox.getText().toString());
match_DTR = 1.455;//Double.parseDouble(DTR_match_textbox.getText().toString());
//math functions
low = Math.round((match_FRC * match_DTR)/((1/100)+1));
high = Math.round((match_FRC * match_DTR)/((5/100)+1));
You need to use a floating point constant instead of integers, e.g.:
As it is, your
((1 / 100) + 1)is an integer expression that evaluates to exactly 1.Making the
1into1.0(or the100into100.0) will cause promotion of the other operands (and the expression as a whole) into floating point.