Why does the number 1e9999… (31 9s) cause problems in R?

前端 未结 3 1528
执笔经年
执笔经年 2021-02-05 01:16

When entering 1e9999999999999999999999999999999 into R, R hangs and will not respond - requiring it to be terminated.

It seems to happen across 3 different

3条回答
  •  情书的邮戳
    2021-02-05 01:31

    R might use sometimes bignums. Perhaps 1e9999999999999999999999999999999 is some threshold, or perhaps the parsing routines have a limited buffer for reading the exponent. Your observation would be consistent with a 32 char (null-terminated) buffer for the exponent.

    I'll rather ask that question on forums or mailing list specific to R, which are rumored to be friendly.

    Alternatively, since R is free software, you could investigate its source code.

提交回复
热议问题