-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Document number types #22067
Document number types #22067
Conversation
263e3cc
to
5e8f0e4
Compare
@@ -2,22 +2,39 @@ | |||
|
|||
## Standard Numeric Types | |||
|
|||
* `Bool` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if Bool isn't in this list, it should be somewhere else at least?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was an oversight, I will add it.
* `Float32` | ||
* `Float64` | ||
* `Complex64` | ||
* `Complex128` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two aliases are probably worth documenting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps. Currently ?Complex128
gives the Complex
docstring. We could mention the aliases there? Feels weird to give aliases their own docstrings.
There is apparently also a Complex32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are the Inf32, NaN32, etc constants documented separately? if so then I think these should be mentioned somewhere. in the Complex docstring is better than not mentioning them anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are here: https://docs.julialang.org/en/stable/stdlib/numbers/?highlight=inf32#general-number-functions-and-constants
( I have already added the aliases to the Complex
docstring.)
- replace the uninformative list in doc/src/stdlib/numbers.md with these new docstrings - move constructor docstring for BigInt from helpdb/Base.jl to base/gmp.jl - add a doctest for BigInt constructor
5e8f0e4
to
facec96
Compare
base/complex.jl
Outdated
@@ -1,5 +1,13 @@ | |||
# This file is a part of Julia. License is MIT: https://julialang.org/license | |||
|
|||
""" | |||
Complex{T<:Real} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When documenting types I think it would be nice if it was standard to also include the supertype:
Complex{T<:Real} <: Number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was thinking about that. We can try to incorporate your show_supertypes()
function in these docstrings maybe?
Added supertypes. I think it is enough to only show the immediate sypertype, since there is merit to keep these short and distinct (IMO). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm modulo the standing comments! :)
base/irrationals.jl
Outdated
""" | ||
Irrational <: Real | ||
|
||
Abstract supertype for irrational numbers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Irrational
is a concrete type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, kinda acts like a supertype though. I will move it and update the docstring.
* document π, e, γ and φ * add type-documentation for number types - replace the uninformative list in doc/src/stdlib/numbers.md with these new docstrings - move constructor docstring for BigInt from helpdb/Base.jl to base/gmp.jl - add a doctest for BigInt constructor * add supertypes to number type docs * move irrational to concrete types (cherry picked from commit f5ed68f)
Original reason for this was to fix #21489 but decided to document all the types, and replace this very underwhelming list with actual docstrings.
Attached the docstrings to
π
,e
,γ
andφ
also (previously onlypi
,eu
,eulergamma
andgolden
had the docstring)