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

Hour comparison in num2date is incorrect #4

Open
penguian opened this issue Jan 16, 2020 · 4 comments
Open

Hour comparison in num2date is incorrect #4

penguian opened this issue Jan 16, 2020 · 4 comments

Comments

@penguian
Copy link
Collaborator

In num2date in mod_datetime.f90, line 1245 has:

  if(num2date % hour == 60)then

Surely that comparison should be to 24, not 60?

@russfiedler
Copy link

Definitely incorrect code.

@aekiss
Copy link

aekiss commented Jan 16, 2020

Good catch - this is in the master at wavebitscientific - maybe raise the issue there?
https://github.com/wavebitscientific/datetime-fortran/blob/master/src/lib/mod_datetime.f90#L1238

@penguian
Copy link
Collaborator Author

Done. wavebitscientific#64

@aekiss
Copy link

aekiss commented Jan 16, 2020

This mix of integer and real arithmetic makes me nervous too.
But I think I'm right in saying 1e3 has an exact representation as a float, so I guess that helps...
https://github.com/wavebitscientific/datetime-fortran/blob/master/src/lib/mod_datetime.f90#L1215-L1228

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

No branches or pull requests

3 participants