Swift 2.0 Study Notes (day 13)--integer and float type for data types

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.