Skip to content
Prev 60879 / 63421 Next

Floating point issue

Hello,

R 4.2.1 on Windows 11, sessionInfo() at end.

I cannot reproduce this either.


op <- options(scipen = 999)

1e24
# [1]  999999999999999983202404
1e24 == 999999999999999983222784
# [1] TRUE

1e25
# [1] 10000000000000000906640224
1e25 == 10000000000000000905969664
# [1] TRUE

10000000000000000905969664
# [1] 10000000000000000906640224

10000000000000003053453312
# [1] 10000000000000003053648442

10000000000000000000000000 == 1e25
# [1] TRUE

options(op)

sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Portugal.utf8 
LC_CTYPE=Portuguese_Portugal.utf8
[3] LC_MONETARY=Portuguese_Portugal.utf8 LC_NUMERIC=C 

[5] LC_TIME=Portuguese_Portugal.utf8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.2.1


Hope this helps,

Rui Barradas

?s 15:44 de 10/07/2022, I?aki Ucar escreveu: