Java: Implementing a Unsigned 128bit Integer

后端 未结 3 784
别跟我提以往
别跟我提以往 2021-02-13 19:13

first off I should ask:
Does anyone knows of a current implementation 128b UINT for Java?

I need something to hold natural cardinal

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-13 19:34

    I would use 32 bit integers as the representation, because you need a bigger type (long) to get the extra precision for the carry bit, overflow detection and multiplication. Think of a 32 bit integer as a digit and apply the algorithms from primary school.

提交回复
热议问题