C Language Learning (third day)

Source: Internet
Author: User

1. Integer type extension type

Extension types are the ability to increase the speed and space in which computers work with data, and the different types of functions on different systems.

Portable Type header file:<stdint.h>, C language creates more type names for existing types, and new type names are defined in <stdint.h>;

Porting: A int32_t (exact width integer type) type represents a 32-bit signed integer type, regardless of the number of bits in the system, and the variables defined by the int32_t type are 32 bits;

Space: such as the int_least8_t (minimum width type) type indicates that there must be at least 8-bit signed integer value (Specify the width) of the smallest integer type, if the system is minimum 16 bits, can still be defined, but the implementation bit 16 bits;

Speed: such as the int_fast8_t (fastest minimum width type) type is defined as the integer type that is the fastest operating speed for a 8-bit signed value in the system;

Larger data types: such as the Intmax (maximum signed integer type) type can store any valid signed integer value, and similar Unitmax types represent the largest unsigned integer types, which may be larger than long long and unsigned long;

Displays a specific type of string macro header file: <inttypes.h>, such as a PRID32 string macro that represents the appropriate conversion description for printing a 32-bit signed value;

2. Floating-point data type

Float type: At least 6 digits of valid number, the value range is at least 10-37--10+37, usually the system stores a float type occupies 32 bits, of which 8 bits are used to represent the values and symbols of the exponent, the remainder represents the non-exponential part;

Double type: At least 13 significant digits can be accurate, the value range is at least 10-37--~, usually the system stores a double type occupies 64 bits, some systems will be more than 32 bits all to represent non-exponential parts, increase the number of effective digits, improve accuracy, Some systems allocate a portion to the exponential portion to accommodate a larger number;

Long double type: satisfies a higher precision than double, but the C language only guarantees that a long double is at least the same precision as a double;

Floating-point constants represent

General: -1.56E+12, 2.87e-3

No decimal point: 2E5

No index: 15.89

No fractional part: 3. E12

No integer part:. 45E-3

system default floating-point constant is double type, plus f or f suffix denotes float type, plus l or l suffix denotes long double type;

Hexadecimal floating-point format: That is, before the hexadecimal number of 0x or 0X, with P or p, respectively, instead of E or E, with a power of 2 instead of the power of 10, 0xa.1fp10,a means that the decimal 10,1f means 1/16 + 15/256,f decimal is 15,p10 is 210 or decimal 1024, which represents a value of (Ten + 1/16 + 15/256) x 1024 = 10364.0;

Print floating-point values

%f the float and double types that print the decimal notation;

%e printing the floating-point number of exponential notation;

If the system supports hex,%a and% a instead of%e printing;

Print long double using%LF,%le,%la;

Overflow and underflow of floating-point values

3. Complex and imaginary types

Complex types: float _complex, double _complex, long double _complex three complex types, each of which should consist of two parts, a real number and a imaginary part;

Imaginary type: float _imaginary, double _imaginary, long double _imaginary three types of imaginary numbers;

If include header file <complex.h> can replace _complex,imaginary with complex instead of _imaginary, use I (I capitalization) instead of square root of-1;

 

  

  

  

  

C Language Learning (third day)

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.