Re: [Rd] Strange Behavior in RNG

2024-08-16 Thread Jiefei Wang
Hi Rui and John, Thanks for your reply. I'm not sure if this is a question for R-help as I think the behavior of RNG is weird, but I will happy to move this discussion if the admin think this is not their topic. I was a C/C++ developer so I understand the double-type numbers sometimes can generat

Re: [Rd] Strange Behavior in RNG

2024-08-16 Thread Rui Barradas
Às 01:45 de 17/08/2024, Jiefei Wang escreveu: Hi, I just observed a strange behavior in R. The rnorm function does not give me the numbers with a given length. I think it is somehow related to the internal representation of double-type numbers but I am not sure if this is supposed to happen. Bel

Re: [Rd] Strange Behavior in RNG

2024-08-16 Thread John Fox
Dear Jiefei Wang, This is really a more appropriate question for the r-help list than for the r-devel list. Neverthless, see item 7.31 in the R FAQ , about floating-point arithmetic. I hope

[Rd] Strange Behavior in RNG

2024-08-16 Thread Jiefei Wang
Hi, I just observed a strange behavior in R. The rnorm function does not give me the numbers with a given length. I think it is somehow related to the internal representation of double-type numbers but I am not sure if this is supposed to happen. Below is a reproducible example ``` ## Create a li