c# - Correct way to store very large integers with maximum performance? -
so working on game in store large numbers, in trillions , quadrillions (a progression type game, la clicker heroes, doing fun).
anyway, c# appears have 32-bit limit on integers, however, can floats very large (eg. 999999999999999.0f)
however, fastest way store large numbers in c#?
i not need accuracy, floating point-type solutions fine. need speed , ability store large integers.
is bigint library way go? how recommend going this?
anyway, c# appears have 32-bit limit on integers, however, can floats very large (eg. 999999999999999.0f)
this categorically false. c# has long
, ulong
types correspond .net's int64
, uint64
types, both 64-bit integers represent number-ranges:
int64 : -9,223,372,036,854,775,808 9,223,372,036,854,775,807 uint64: 0 18,446,744,073,709,551,615.
that's:
eighteen quintillion, 4 hundred , forty 6 quadrillion, 7 hundred , forty 4 trillion, seventy-three billion, 7 hundred , 9 million, 5 hundred , fifty-one thousand, , 6 hundred , fifteen.
and if need store bigger numbers can implement own uint128
joining 2 uint64
values , using schoolbook techniques combine 2 common arithmetic operations.
Comments
Post a Comment