Closed gevro closed 2 years ago
1427398577
is a 'double' value, whereas 1427398577L
(trailing L
) is an 'integer'.
If you add the two numbers as integers, they overflow
> 1427398577L + 1427397578L
[1] NA
Warning message:
In 1427398577L + 1427397578L : NAs produced by integer overflow
but not as doubles, as you show, or when sum()
is applied to an integer vector, as you also show.
width()
of a GRanges returns an integer value, and sum()
of integer values returns integer values if the inputs are integer and don't overflow. So the NA in your original code arises because you're adding two integer values
Interesting. I don’t quite understand why R doesn’t recognize an overflow and then convert to double automatically.
Hi, I'm getting the below strange overflow issue.
As you can see, the value of each of the two terms is coming out fine. And when summing those numbers manually. But for some reason, when I sum the terms, I get an error.
This seems like a deep bug in GenomicRanges and/or R?
Also, this seems to work: