From 79b52741e1ec3e36cc60fffbf3e5197322a80318 Mon Sep 17 00:00:00 2001 From: Priynsh <119518987+Priynsh@users.noreply.github.com> Date: Sat, 7 Dec 2024 16:08:23 +0530 Subject: [PATCH 1/4] Update complex-and-rational-numbers.md fixes rational docs --- doc/src/manual/complex-and-rational-numbers.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/src/manual/complex-and-rational-numbers.md b/doc/src/manual/complex-and-rational-numbers.md index 9cab2ed1e4f24..e983b75c7c8bc 100644 --- a/doc/src/manual/complex-and-rational-numbers.md +++ b/doc/src/manual/complex-and-rational-numbers.md @@ -254,13 +254,29 @@ julia> float(3//4) ``` Conversion from rational to floating-point respects the following identity for any integral values -of `a` and `b`, with the exception of the two cases `b == 0` and `a == 0 && b < 0`: +of `a` and `b`, with the exception of the two cases `a==0 && b==0` and `a==0 && b < 0`: ```jldoctest julia> a = 1; b = 2; julia> isequal(float(a//b), a/b) true +julia> a, b = 0, 0 +(0, 0) + +julia> float(a//b) +ERROR: ArgumentError: invalid rational: zero(Int64)//zero(Int64) +Stacktrace: +... + +julia> a/b +NaN + +julia> a, b = 0, -1 +(0, -1) + +julia> float(a//b), a/b +(0.0, -0.0) ``` Constructing infinite rational values is acceptable: From 5907e4a8af74185b8a3d2b3def2231e4da1e1321 Mon Sep 17 00:00:00 2001 From: Priynsh <119518987+Priynsh@users.noreply.github.com> Date: Sat, 7 Dec 2024 18:12:34 +0530 Subject: [PATCH 2/4] Update complex-and-rational-numbers.md --- doc/src/manual/complex-and-rational-numbers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/manual/complex-and-rational-numbers.md b/doc/src/manual/complex-and-rational-numbers.md index e983b75c7c8bc..062c82e727b43 100644 --- a/doc/src/manual/complex-and-rational-numbers.md +++ b/doc/src/manual/complex-and-rational-numbers.md @@ -267,7 +267,7 @@ julia> a, b = 0, 0 julia> float(a//b) ERROR: ArgumentError: invalid rational: zero(Int64)//zero(Int64) Stacktrace: -... +[...] julia> a/b NaN From 1f8da0fb18a72f2da2d22934365244a75d02cba7 Mon Sep 17 00:00:00 2001 From: Priynsh <119518987+Priynsh@users.noreply.github.com> Date: Mon, 9 Dec 2024 04:27:20 +0530 Subject: [PATCH 3/4] Update doc/src/manual/complex-and-rational-numbers.md Co-authored-by: Max Horn --- doc/src/manual/complex-and-rational-numbers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/manual/complex-and-rational-numbers.md b/doc/src/manual/complex-and-rational-numbers.md index 062c82e727b43..93be5df87e0ca 100644 --- a/doc/src/manual/complex-and-rational-numbers.md +++ b/doc/src/manual/complex-and-rational-numbers.md @@ -254,7 +254,7 @@ julia> float(3//4) ``` Conversion from rational to floating-point respects the following identity for any integral values -of `a` and `b`, with the exception of the two cases `a==0 && b==0` and `a==0 && b < 0`: +of `a` and `b`, except when `a==0 && b <= 0`: ```jldoctest julia> a = 1; b = 2; From 77dd812de308deea128fc983a96c25384a527458 Mon Sep 17 00:00:00 2001 From: Priynsh <119518987+Priynsh@users.noreply.github.com> Date: Tue, 10 Dec 2024 21:59:28 +0530 Subject: [PATCH 4/4] Update complex-and-rational-numbers.md added mising line --- doc/src/manual/complex-and-rational-numbers.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/src/manual/complex-and-rational-numbers.md b/doc/src/manual/complex-and-rational-numbers.md index 93be5df87e0ca..d1d6ffeca245f 100644 --- a/doc/src/manual/complex-and-rational-numbers.md +++ b/doc/src/manual/complex-and-rational-numbers.md @@ -261,6 +261,7 @@ julia> a = 1; b = 2; julia> isequal(float(a//b), a/b) true + julia> a, b = 0, 0 (0, 0)