(可重复的例子被添加)
我的64位操作系统和32位R中计算机中的最大正双(浮点)数是:
.Machine$double.xmax # 1.797693e+308
所以,以下是TRUE
:
is.finite(1.797683e+308) # TRUE; here, as argument I used 1.797683e+308
那么,那么由于TRUE
,我可以获得is.finite
的计算机中的最大实数是多少?
以下是该问题的部分答案:
is.finite(179769313486231570838400602864442228000008602082842266064064680402680408280648240046204888888288080622822420842246006644866884860462806420066668022046626024066662068886808602862886866800048228686262462640668044406484606206082824406288200264266406808068464046840608044222802268424008466606886862062820068082689.99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999) # TRUE
is.finite(179769313486231570838400602864442228000008602082842266064064680402680408280648240046204888888288080622822420842246006644866884860462806420066668022046626024066662068886808602862886866800048228686262462640668044406484606206082824406288200264266406808068464046840608044222802268424008466606886862062820068082689.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990) # FALSE; One more digit ("0") at the end of the decimal point killed it!
is.finite(179769313486231570838400602864442228000008602082842266064064680402680408280648240046204888888288080622822420842246006644866884860462806420066668022046626024066662068886808602862886866800048228686262462640668044406484606206082824406288200264266406808068464046840608044222802268424008466606886862062820068082690) # TRUE (For math, it is absurd this to be returned "TRUE"). Why is this returned TRUE instead of FALSE?
is.finite(1797693134862315708384006028644422280000086020828422660640646804026804082806482400462048888882880806228224208422460066448668848604628064200666680220466260240666620688868086028628868668000482286862624626406680444064846062060828244062882002642664068080684640468406080442228022684240084666068868620628200680826990) # FALSE
以上三行代码表明is.finite
从数学角度来看并不像预期的那样有效!
我在以下在线R服务器中测试了这种情况,我得到了相同的“TRUE,FALSE,TRUE”结果:
在线R服务器:
https://paiza.io/projects/pTHIb6DfqKIFnBFBjEykdQ?language=r
https://www.tutorialspoint.com/execute_r_online.php
https://rdrr.io/snippets/
https://rextester.com/l/r_online_compiler
https://www.jdoodle.com/execute-r-online
一旦我找到了这种情况背后的逻辑,我也会在这里添加它。