Arbitrary precision arithmetic with Ruby

前端 未结 5 919
醉话见心
醉话见心 2021-01-13 04:18

How the heck does Ruby do this? Does Jörg or anyone else know what\'s happening behind the scenes?

Unfortunately I don\'t know C very well so bignum.c is of little

5条回答
  •  半阙折子戏
    2021-01-13 04:29

    You could read the source for bignum.c...

    At a very high level, without going into any implementation details, bignums are calculated "by hand" like you used to do in grade school. Now, there are certainly many optimizations that can be applied, but that's the gist of it.

提交回复
热议问题