try "return (0.5 * height * base);" instead of "return 1/2 * height * base;" It may be the 1/2 vs. 0.5