How to store numbers greater than 2^64

Hi there! In continuation of “how to save strings in the storage of DApp topic” I thought about decimals. For example, I want to issue the ETH token with decimals 18, but the maximum number type in sway is u64 and that means I can use numbers till 2^18 = ~18.4467 * 1e18.
Is it possible to somehow use a larger type, or maybe it will be possible to store a large number as a string?

If you need really large numbers, the sway standard library has both U128 and U256 types available.

4 Likes

Thanks, will try to use U128 and U256 :saluting_face:

1 Like

Thank for the question. I got it

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.