diff --git a/tracks/java/exercises/rational-numbers/mentoring.md b/tracks/java/exercises/rational-numbers/mentoring.md new file mode 100644 index 000000000..a0068fa00 --- /dev/null +++ b/tracks/java/exercises/rational-numbers/mentoring.md @@ -0,0 +1,11 @@ +The tolerance (DOUBLE_EQUALITY_TOLERANCE) is too small for the unit test testRaiseARealNumberToAPositiveRationalNumber(). +The calculation of exp() is too numerically sensitive to whether the user implements +``` +Math.pow(Math.pow(x, numerator), 1.0/denominator) +``` +or +``` +Math.pow(Math.pow(x, 1.0/denominator), numerator) +``` +Both are mathematically equivalent, however, the first one fails the unit test whereas the second passes. +Furthermore, the instructions to the exercise bias the user towards the first implementation.