-
Notifications
You must be signed in to change notification settings - Fork 424
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
Math module - rename isnan #19019
Comments
If I could be so bold, there is no such thing as an Nan. There is a Not-a-Number which has already been abbreviated to NaN back in the 1980s. There are two types. One is a quiet NaN and the other is a signalling NaN, abbreviated to qNaN and sNaN respectively. The difference is a single bit in the bit-wise representation. Whether hardware supports signalling NaN s is another thing. The name used in the C standard for such a quiet NaN is NAN. Is this the best name? Well, it is in that standard. I cannot fight it. So, if you are going to camel case something, and for a 5 letter routine name, I question that but I am going to loose that argument even though the name has been around for 35+ years, it should be Note that with your newly camel-cased name assert(isNaN(x) == (x != x)); This routine was introduced because some compilers' optimizers were flawed and were too broken to realise that in an IEEE 754 world that gioven a real(w) identifier, the expressions x == x
x != x cannot be determined at compile-time and need to be evaluated at run-time. So the Your manual should be suggesting that Chapel users avoid the use of I personally do not use the routine, I use the expression but then I ensure that I am not using krap compilers. The last time I checked, the chpl compiler did the right thing with the boolean expression form. |
Regarding |
Prep for an upcoming ad-hoc subteam discussion 1. What is the API being presented? /* Returns `true` if the argument `x` does not represent a valid number;
`false` otherwise. */
inline proc isnan(x: real(64)): bool
/* Returns `true` if the argument `x` does not represent a valid number;
`false` otherwise. */
inline proc isnan(x: real(32)): bool How is it intended to be used?Damian points out that it was originally added because some compilers’ optimizers couldn’t recognize that How is it being used in Arkouda and CHAMPS?In Arkouda:
In CHAMPS:
2. What's the history of the feature, if it already exists?These functions predated the proc and inline keywords. Both were originally added in 2007. The 64 bit version being added alongside support for complex numbers, which it was used to support. The 32 bit version support was added shortly after, alongside 32 bit versions of the other math functions. They were originally extern functions, and when extern functions started generating prototypes, needed Their implementation was adjusted in 2012 to avoid using Documentation for these functions was added in 2015. There was an attempt to unify the overloads of each into a single function, but this was thwarted by promotion. Were moved to AutoMath.chpl when the split happened so that they could continue to be included in user programs by default. 3. What's the precedent in other languages, if they support it?a. Python Python provides b. C/C++ C/C++ provides c. Rust Rust provides d. Swift Like e. Julia Julia provides f. Go Go provdes 4. Are there known Github issues with the feature?
5. Are there features it is related to? What impact would changing or adding this feature have on those other features?
6. How do you propose to solve the problem?A. Rename to isNan
B. Rename to isNaN
C. Deprecate it entirely?
I think we should follow B. We should also add the documentation note Damian suggested |
In our discussion today, we decided to rename this to This was decided by looking at the combination of this name and the naming of Discussion points:
We are willing to meet again if new counterpoints are presented. |
[reviewed by @ShreyasKhandekar] Renames: - `INFINITY` to `inf` - `NAN` to `nan` - `isfinite` to `isFinite` - `isinf` to `isInf` - `isnan` to `isNan` These functions were not following the standard module style guide rules and so needed to be adjusted. Resolves #19016 Resolves #19017 Resolves #19019 Updated documentation links to refer to the new symbol rather than the old one. Added tests to lock in the deprecation messages Updated tests that were using the deprecated versions to use the new versions instead. Passed a full paratest with futures
This function should be camelCased. Whether that means
isNan
orisNAN
is still up for discussion via #6698. Whatever decision is reached should likely be consistent with #19016The text was updated successfully, but these errors were encountered: