original articles, welcome reprint. Reprint Please specify: Dongsheng's blog
Swiftprovide8, -, +, -a signed and unsigned integer in bit form. These integer types followCthe naming conventions of language, I summed upSwiftintegral type in:
Example of an integral type:
Print ("UInt8 range: \ (uint8.min) ~ \ (Uint8.max)")
print ("Int8 range: \ (int8.min) ~ \ (Int8.max)")
print ("UInt range: \ (uint.min) ~ \ (Uint.max)")
Print("UInt64 range: \ (uint64.min) ~ \ (Uint64.max)")
Print ("Int64 range: \ (int64.min) ~ \ (Int64.max)")
Print ("Int range: \ (int.min) ~ \ (Int.max)")
The output results are as follows:
UInt8 range:0 ~ 255
Int8 Range: 128 ~ 127
UInt range:0 ~ 18446744073709551615
UInt64 range:0 ~ 18446744073709551615
Int64 Range: 9223372036854775808 ~ 9223372036854775807
Int Range:-9223372036854775808 ~ 9223372036854775807
The above code is through an integer min and the Max Property calculates the range of each type.
Floating-point types are primarily used to store decimal values, and can be used to store large integers. It is divided into floating-point (float) and double-precision floating-point (double), double-precision floating-point numbers use more memory space than floating-point number, can represent the range of values and precision is also relatively large.
Welcome to follow Dongsheng Sina Weibo @tony_ Dongsheng.
Learn about the latest technical articles, books, tutorials and information on the public platform of the smart Jie classroom
More Products IOS,Cocos, mobile design courses please pay attention to the official website of Chi Jie Classroom:http://www.zhijieketang.com
Luxgen Classroom Forum Website:http://51work6.com/forum.php
Swift 2.0 Study Notes (day 13)--integer and float type for data types