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

Doc: clarifying irrational #38057

Closed
wants to merge 3 commits into from

Conversation

PallHaraldsson
Copy link
Contributor

Clarifying (fixing?) #37977

[skip ci]

Clarifying (fixing?) JuliaLang#37977

[skip ci]
base/irrationals.jl Outdated Show resolved Hide resolved
@petvana
Copy link
Member

petvana commented Oct 16, 2020

Any specific reason not to format Float64, -pi, and as a code? (`Float64`)

@PallHaraldsson
Copy link
Contributor Author

PallHaraldsson commented Oct 16, 2020

Not really, I just overlooked that, actually copied from your fixed text (where Float64 wasn't like that, and still the extra word) but then changed to the pi symbol. It's now fixed, and I'm ok with this merged as is, if you/others are.

@ViralBShah ViralBShah added the docs This change adds or pertains to documentation label Oct 22, 2020
arithmetic operations with other numeric quantities.
Number type representing an exact irrational value, which is automatically rounded to the "correct" precision in
arithmetic operations with other numeric quantities. Even the simplest calculations, such as `-pi` or `2π` convert a
number to `Float64`, making the result no longer irrational.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rephrase:

Calculations involving arithmetic between numeric types and irrational types will lead to conversion to a numeric type. For example, -pi or 2π produce Float64 results.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to note that -pi is unary, and thus not an arithmetic operation between a numeric type and irrational.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove it then?

Copy link
Contributor Author

@PallHaraldsson PallHaraldsson Oct 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just going to change, but I have second thoughts about "Calculations involving arithmetic" (as synonyms?) and "between numeric types". With pi a number, this could be misunderstood, so I was thinking Number types, but I see it has misleading help "Abstract supertype for all number types".

Also should clarification rather go into Irrational and/or AbstractIrrational?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"-pi is unary, and thus not an arithmetic operation", mathematically not an operation? But in Julia, it's a unary operator as in almost all languages, and involves calculation:

-(x::AbstractIrrational) = -Float64(x)

@PallHaraldsson PallHaraldsson deleted the patch-25 branch October 22, 2020 20:47
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.

3 participants