Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix complex - rational docs #56772

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion doc/src/manual/complex-and-rational-numbers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Priynsh marked this conversation as resolved.
Show resolved Hide resolved

```jldoctest
julia> a = 1; b = 2;

julia> isequal(float(a//b), a/b)
true
julia> a, b = 0, 0
Priynsh marked this conversation as resolved.
Show resolved Hide resolved
(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:
Expand Down
Loading