-
-
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
Move irrational constants to its own module #23427
Conversation
base/irrationals.jl
Outdated
log(::Irrational{:e}, x::Number) = log(x) | ||
|
||
# align along = for nice Array printing | ||
function alignment(io::IO, x::Irrational) |
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.
Was this method removed on purpose?
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.
No, should have been moved.
This was discussed in triage and the preferred resolution was the following:
|
I think we should probably export |
seems fine as well. |
e64f1b5
to
c309521
Compare
@@ -5299,7 +5299,7 @@ for (bdsdc, elty) in | |||
u, &ldu, vt, &ldvt, | |||
q, iq, work, iwork, info) | |||
chklapackerror(info[]) | |||
d, e, u, vt, q, iq | |||
d, e_, u, vt, q, iq |
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.
Apparently we returned that mathematical constant e
from LAPACK.bdsdc!
. 🤘
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.
Just checked and e_
is just garbage after the call to xbdsdc
so maybe just delete it (and adjust svd
)
At time of writing I think this PR now implements the new behaviour. I think the easiest would be to incorporate #10612 in this PR for the deprecation of |
Note that ISO mandates that mathematical constants are to be typeset with roman (upright) font, thus using |
|
In that case we should probably wrap everything regarding irrationals in that module, not just the constants. |
I actually like that we export ASCII |
Exporting a one letter variable is way too error prone for a general purpose language, in my opinion. I have thrown |
Doesn't the exact same argument apply to |
It sort of does, although I guess it is more rare to use |
I have never used e but use |
Is this referring to:
? (edit: or is there a link to something that could have been added to the OP?) (edit2: I guess the discussion was in #10612...) |
|
This is a breaking change, because the type of the Euler's number is different. This can probably be handled in |
I must say I still don't like the Unicode alias for |
Could use some guidance on how to deprecate stuff here. Are we OK with just make this breaking? I tried some things e.g. export e
e = Irrational{:e}()
Float64(::Irrational{:e}) = (depwarn("e is moved etc...", :Float64); Float64(ℯ))
# ... but then you get a conflict when
Any way to actually deprecate this? |
Should be able to use |
Hmmmm, I was sure I tried that, but seems to work. Does not give a very helpful message though: julia> e
WARNING: Base.e is deprecated.
likely near no file:0
ℯ = 2.7182818284590... |
@Keno "Make ℯ (\mscre)" What does "mscre" stand for anyway? I'm never going to remember this unless I know.. Can we have (also) \e and/or \euler for "Euler's number"?: https://en.wikipedia.org/wiki/e (mathematical constant). Just in case it's not a good idea, note there's also: https://en.wikipedia.org/wiki/Euler–Mascheroni constant |
|
mscre stands for "math script e". We can and should add another unicode alias. |
- only export pi, π and ℯ from Base - remove eu as alias for ℯ - add \euler as tab completion for ℯ
c309521
to
abc6aa2
Compare
Ok, so lets decide on a name for the module? julia> e
WARNING: Base.e is deprecated.
likely near no file:0
ℯ = 2.7182818284590...
julia> e
WARNING: Base.e is deprecated.
likely near no file:0
ℯ = 2.7182818284590... The warning is rather cryptic, and does not suggest the alternative and also prints more than once. This works though; julia> using Base.MathConstants
julia> e
ℯ = 2.7182818284590... Any ideas would be much appreciated. |
@@ -363,6 +363,15 @@ Deprecated or removed | |||
|
|||
* `diagm(A::BitMatrix)` has been deprecated, use `diagm(vec(A))` instead ([#23373]). | |||
|
|||
* `ℯ` (written as `\mscre<TAB>` or `\euler<TAB>`) is the new default for Euler's |
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.
What does it mean for this to be "the new default"? Default in what sense?
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.
The one being exported, and also typeof(e)
has changed from Irrational{:e}
to Irrational{:ℯ}
.
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.
Ok, might be good to clarify that if you're willing!
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 think my own wording is kinda weird too.
No description provided.