What are the maximum and minimum values accepted by the following data types (Kotlin): Double, Float, Long, Int, Short, Byte | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

14th Sep 2020, 9:20 PM
dign_code
dign_code - avatar
3 Answers
+ 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
14th Sep 2020, 9:42 PM
Rik Wittkopp
Rik Wittkopp - avatar
17th Sep 2020, 2:38 AM
John Wells
John Wells - avatar
+ 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.
14th Sep 2020, 9:57 PM
Seb TheS
Seb TheS - avatar