From 975118d10b3793827072df2cf3ea0b2ddf673ea9 Mon Sep 17 00:00:00 2001 From: David Sletten Date: Sat, 2 Jul 2022 16:30:22 -0400 Subject: [PATCH] Create mentoring.md --- tracks/java/exercises/rational-numbers/mentoring.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tracks/java/exercises/rational-numbers/mentoring.md 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.