Difference between int, uint and Number

TiShow
Apr 13, 2022

--

int
Signed integer. 32-bit width.

  • From -2147483648 to 2147483647.

uint
Unsigned integer. 32-bit width.

  • From 0 to 4294967295.

If this range is not enough, use Number.

Number
Real number. Double precision floating point. 15 significant digits. Up to 52 bits for integer values.

Using int / uint is faster than using Number.
If int or uint is enough, this is a good choice.

But I recommend to use int for integers, even if they are not negative numbers. uint should only be used for RGB color specifications, bitmasks, and other non-numeric values.

--

--

TiShow
TiShow

Written by TiShow

80% is the creation, the rest is depression. Developer and Data scientist. Looking for Physics Ph.D Twitter: @_t_i_show

No responses yet