2

What is it and why is it written like that. I check pre-sale contract and it was defined in integer.

uint constant TOKEN_LIMIT = 444 * 1e6 * 1e18;

Specifically that part: 1e6 * 1e18

I really didn't get it and I tried to google it but I'm out of ideas.

1 Answer 1

2

Soldity can't handle floating point numbers so it must store decimals in integer form.

The 1e<n> notation basically means "1 followed by n number of zeros". So 1e2 is equal to 100 and 1e4 is equal to 10000, and so on.

The expression 444 * 1e6 * 1e18 then means:

444

1e6 = 1000000 (6 zeros)

1e18 = 1000000000000000000 (18 zeros)

so TOKEN_LIMIT = 444 × 1000000 × 1000000000000000000

There are 444,000,000 total tokens (444 × 1e6), but taking account decimal places (the SOMN token supports up to 18 decimal places) it then becomes (444,000,000 × 1e18).

TLDR; 1eN is exponential notation, to better represent the number of zeros. Solidity only supports fixed-point numbers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.