Why can Haskell handle very large numbers easily?

后端 未结 8 1922
遇见更好的自我
遇见更好的自我 2021-01-01 11:09
Hugs> 94535^445
13763208823213770506960538876615156211048901640052821530697264247739998018468419032448277029434879827074549660094560167350418780006041435009085328         


        
8条回答
  •  一向
    一向 (楼主)
    2021-01-01 11:31

    It is a matter of how to encode numbers. The traditional way to do this is to encode numbers with a given number of bits, where you cannot have infinite accuracy. Haskell apparently do this with a variable number of bits for a number which is also fine, but usually mean that all math has do be done in software, as hardware acceleration is generally only available for finite accuracy.

提交回复
热议问题