-
-
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
add irrational constant ° = pi/180, for converting degrees to radians #16765
Conversation
…, especially for constants
-1 from me: since I think I would prefer the |
@simonbyrne, if someone writes The problem with a |
Regarding @simonbyrne's argument: if you write |
@@ -599,4 +604,3 @@ As ``BigInt`` represents unbounded integers, the interval must be specified (e.g | |||
Create an array of the size ``jumps`` of initialized ``MersenneTwister`` RNG objects where the first RNG object given as a parameter and following ``MersenneTwister`` RNGs in the array initialized such that a state of the RNG object in the array would be moved forward (without generating numbers) from a previous RNG object array element on a particular number of steps encoded by the jump polynomial ``jumppoly``\ . | |||
|
|||
Default jump polynomial moves forward ``MersenneTwister`` RNG state by 10^20 steps. | |||
|
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.
is your editor doing this? check that genstlib doesn't put it back
@eschnett Granted, |
While it may be useful in some cases, I think having application of a degree symbol yield a numeric value which is not in degrees is counter-intuitive. Better to leave this to package developers (who may have other uses, like temperature or music notation). |
Overall, I really like the idea of defining But I feel the proposal that
Indeed. We shouldn't forbid |
I also think that it would seem better to preserve the identity of degrees (through a Sure, it's more work, but we do want Base to play more nicely with units #15394, and as far as I understand, it is basically that work which is needed. |
Okay, seems like the consensus is against having this in Base. |
I'm all for the syntax |
I'm worried that |
This allows you to have a constant like
30°
yield the angle in radians, as discussed in #16760.On the one hand, this syntax is almost too cute. On the other hand, it's not clear what else one could do with the
°
identifier, and wanting to define angular constants in degrees is undeniably common and useful. (Declaring it to be a specialDegree
type, while it would allow for more error checking, seems like it would get too intrusive ... too many functions would need new methods if we introduced a new numeric type.)The main other option discussed in #16760 would be to define
°
as a postfix operator equivalent todeg2rad
, probably with high precedence. This is also workable, but would disallow°
in identifiers, and it's not at all clear to me that an expression likeφ°
should be a function call rather than just a variable name.