From 6428cbe78581e9dc8e8e7db9cde6daa895a33325 Mon Sep 17 00:00:00 2001 From: Sascha Mann Date: Sun, 10 Oct 2021 21:26:35 +0200 Subject: [PATCH 1/2] rational-numbers: Clarify that denominator can be 0 In some languages the denominator can be 0 and therefore the track's implementation of this exercise may expect it. Stating `b != 0` in the description may be misleading if the track expects it. --- exercises/rational-numbers/description.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/rational-numbers/description.md b/exercises/rational-numbers/description.md index bbeae447ea..b9d16d59ce 100644 --- a/exercises/rational-numbers/description.md +++ b/exercises/rational-numbers/description.md @@ -1,6 +1,6 @@ # Description -A rational number is defined as the quotient of two integers `a` and `b`, called the numerator and denominator, respectively, where `b != 0`. +A rational number is defined as the quotient of two integers `a` and `b`, called the numerator and denominator, respectively. The absolute value `|r|` of the rational number `r = a/b` is equal to `|a|/|b|`. From 0fafc4809205953c9e181d3f13da94fd28367ee1 Mon Sep 17 00:00:00 2001 From: Sascha Mann Date: Tue, 26 Oct 2021 15:06:39 +0200 Subject: [PATCH 2/2] Move info to note --- exercises/rational-numbers/description.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/exercises/rational-numbers/description.md b/exercises/rational-numbers/description.md index b9d16d59ce..33bfccc015 100644 --- a/exercises/rational-numbers/description.md +++ b/exercises/rational-numbers/description.md @@ -1,6 +1,12 @@ # Description -A rational number is defined as the quotient of two integers `a` and `b`, called the numerator and denominator, respectively. +A rational number is defined as the quotient of two integers `a` and `b`, called the numerator and denominator, respectively, where `b != 0`. + +~~~~exercism/note +Note that mathematically, the denominator can't be zero. +However in many implementations of rational numbers, you will find that the denominator is allowed to be zero with behaviour similar to positive or negative infinity in floating point numbers. +In those cases, the denominator and numerator generally still can't both be zero at once. +~~~~ The absolute value `|r|` of the rational number `r = a/b` is equal to `|a|/|b|`.