+ 1
What are the maximum and minimum values accepted by the following data types (Kotlin): Double, Float, Long, Int, Short, Byte
And also what are the differences between them
3 Respostas
+ 8
I looked into this myself recently.
Let me share 2 codes which may help you understand.
https://code.sololearn.com/cL663L9Ggllf/?ref=app
https://code.sololearn.com/cfElabe1tGAs/?ref=app
+ 7
There are constants defined for each of the types. I have been extending the course. These post show those constants.
https://www.sololearn.com/post/491444
https://www.sololearn.com/post/481457
https://www.sololearn.com/post/482120
https://www.sololearn.com/post/482929
https://www.sololearn.com/post/485284
https://www.sololearn.com/post/492504
+ 1
Based on C++:
Short, Long and Long Long are integers with different memory requirements and ranges.
short: 2 bytes
int: 4 bytes
long: 4 bytes
long long: 8 bytes
An integer can be signed or unsigned.
An integer, which requires A bytes of memory has range:
(signed) (-256^A/2)–(256^A/2-1)
(unsigned) 0–(256^A-1)
For example a signed short has a range (-256^2/2)–(256^A/2-1) = -32768–32767.