[Rd] Double to uint64_t on M1

Dipterix Wang d|pter|x@w@ng @end|ng |rom gm@||@com
Thu Aug 12 06:50:47 CEST 2021


Thank you,

I guess I should convert double to uint64_t instead of int64_t...

The reason why I asked is because bit64 package `bit64::as.integer64(2^63)` produces different results on my machine vs. another server. This package converts double to int64_t directly. Looks like this is a bug in their package.

Thanks!

Best,

- Dipterix

> On Aug 11, 2021, at 11:52 PM, Simon Urbanek <simon.urbanek using R-project.org> wrote:
> 
> hing to do with R. 2^63 is too large to be represented as singed integer, so the behavior is undefined - to quote from the C99 specs (6.3.1.4):
> 
> "If the value of the integral part cannot be represented by the integer type, the behavior is undefined."
> 
> Your subject doesn't match your question as the uint64_t conversion is well-defined and the same on both platforms, but the conversion to int64_t in undefined


	[[alternative HTML version deleted]]



More information about the R-devel mailing list