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

Fix functions/values used for multiply x2 test #669

Merged

Conversation

jeanlucf22
Copy link
Collaborator

No description provided.

@jmohdyusof
Copy link
Collaborator

Should like 37 and 39 use the same format? I have no opinion on which is preferred (but happy to learn)

@jeanlucf22
Copy link
Collaborator Author

Should like 37 and 39 use the same format? I have no opinion on which is preferred (but happy to learn)

The 'f' is for float only, not double (if I understand it right)

@jmohdyusof
Copy link
Collaborator

So is 2e-6 interpreted as a double?

@jeanlucf22
Copy link
Collaborator Author

I believe so, that is why you do not see a warning for that one

@jmohdyusof
Copy link
Collaborator

This seems to be correct. I would prefer something like 2e-6f (but I am not sure it is allowed) just because I dislike having to count zeros

@nicolasbock nicolasbock self-assigned this Nov 15, 2022
@nicolasbock
Copy link
Collaborator

nicolasbock commented Nov 15, 2022

With gcc-12.2.0 I get the following:

#include <stdlib.h>
#include <stdio.h>

int main() {
    printf("sizeof() = %lu\n", sizeof(1e-6f));
}
$ gcc test.c && ./a.out 
sizeof() = 4

So it is possible to write the literal in e notation (for @jmohdyusof 😄) and also force it to be float.

@nicolasbock
Copy link
Collaborator

I forgot to add that I would also prefer the 'e' notation. Counting zeros is error prone.

@jmohdyusof
Copy link
Collaborator

Assuming this does not fail with any compilers we need, I would advocate this change, and approve otherwise.

@jeanlucf22 jeanlucf22 force-pushed the 668-fix-abs-value-compiler-warnings branch from ce23c5b to ba2afd7 Compare November 15, 2022 18:13
Copy link
Collaborator

@jmohdyusof jmohdyusof left a comment

Choose a reason for hiding this comment

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

Approved, will test on Intel and Darwin

@nicolasbock nicolasbock merged commit 7738322 into lanl:master Nov 17, 2022
@jeanlucf22 jeanlucf22 deleted the 668-fix-abs-value-compiler-warnings branch January 20, 2023 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants