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

Document number types #22067

Merged
merged 4 commits into from
May 28, 2017
Merged

Conversation

fredrikekre
Copy link
Member

@fredrikekre fredrikekre commented May 26, 2017

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 only pi, eu, eulergamma and golden had the docstring)

@tkelman tkelman added the docs This change adds or pertains to documentation label May 26, 2017
@@ -2,22 +2,39 @@

## Standard Numeric Types

* `Bool`
Copy link
Contributor

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?

Copy link
Member Author

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`
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

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

Copy link
Member Author

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
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}
Copy link
Member

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

Copy link
Member Author

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?

@fredrikekre
Copy link
Member Author

Added supertypes. I think it is enough to only show the immediate sypertype, since there is merit to keep these short and distinct (IMO).

Copy link
Member

@Sacha0 Sacha0 left a 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! :)

"""
Irrational <: Real

Abstract supertype for irrational numbers.
Copy link
Member

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

Copy link
Member Author

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.

@KristofferC KristofferC merged commit f5ed68f into JuliaLang:master May 28, 2017
@fredrikekre fredrikekre deleted the fe/doc-numbers branch May 28, 2017 13:41
tkelman pushed a commit that referenced this pull request Jun 3, 2017
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Help regression for Rational in 0.6
6 participants