Skip to content

as.numeric for POSIXct to prevent overflow#3781

Merged
mattdowle merged 5 commits intomasterfrom
idate_overflow
Aug 29, 2019
Merged

as.numeric for POSIXct to prevent overflow#3781
mattdowle merged 5 commits intomasterfrom
idate_overflow

Conversation

@MichaelChirico
Copy link
Copy Markdown
Member

@MichaelChirico MichaelChirico commented Aug 19, 2019

Closes #3780

Alternative is to check abs(as.numeric(x)) <= .Machine$integer.max & is as.integer/as.numeric as appropriate, but I'm not sure the balance between the abs check and efficiency of as.integer vis-a-vis as.numeric

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 20, 2019

Codecov Report

Merging #3781 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3781   +/-   ##
=======================================
  Coverage   99.41%   99.41%           
=======================================
  Files          71       71           
  Lines       13199    13199           
=======================================
  Hits        13122    13122           
  Misses         77       77
Impacted Files Coverage Δ
R/IDateTime.R 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a8e926a...c2605ef. Read the comment docs.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 20, 2019

Codecov Report

Merging #3781 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3781   +/-   ##
=======================================
  Coverage   99.41%   99.41%           
=======================================
  Files          71       71           
  Lines       13242    13242           
=======================================
  Hits        13165    13165           
  Misses         77       77
Impacted Files Coverage Δ
R/IDateTime.R 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 463ee57...2c65416. Read the comment docs.

Copy link
Copy Markdown
Member

@jangorecki jangorecki left a comment

Choose a reason for hiding this comment

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

LGTM

@mattdowle mattdowle changed the title Closes #3780 -- use as.numeric for POSIXct to prevent overflow as.numeric for POSIXct to prevent overflow Aug 29, 2019
@mattdowle mattdowle added this to the 1.12.4 milestone Aug 29, 2019
@mattdowle mattdowle merged commit f4a3f06 into master Aug 29, 2019
@mattdowle mattdowle deleted the idate_overflow branch August 29, 2019 20:03
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.

as.IDate returns NAs when converting from POSIX

3 participants