In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the common Flex data types, the article is very detailed, has a certain reference value, interested friends must read it!
Flex data type description
Primitive data types include Boolean, int, Null, Number, String, uint, and void. The ActionScript core class also defines the following complex data types: Object, Array, Date, Error, Function, RegExp, XML, and XMLList.
◆ Boolean data type
The Boolean data type contains two values: true and false. For variables of type Boolean, any other value is invalid. The default value for Boolean variables that have been declared but not initialized is false.
◆ int data type
The int data type in the Flex data type is internally stored as 32-bit integers and contains a set of integers between-2147483648 (- 231) and 2147483647 (231-1) (including-2147483648 and 2147483647). Earlier versions of ActionScript provided only the Number data type, which can be used for both integer and floating point numbers. In ActionScript3.0, you can now access low machine types of 32-bit signed and unsigned integers. If your variables will not use floating-point numbers, it should be faster and more efficient to use int data types instead of Number data types.
For integer values that are less than the minimum value of int or greater than the * * value of int, the Number data type should be used. The Number data type can handle values between-9007199254740992 and 9007199254740992 (53-bit integer values). The default value for variables of the int data type is 0.
◆ Null data type
The Null data type in the Flex data type contains only one value: null. This is the default value for String data types and all classes used to define complex data types, including the Object class. Other primitive data types, such as Boolean, Number, int, and uint, do not contain null values. If you try to assign null to a variable of type Boolean, Number, int, or uint, FlashPlayer converts the null value to the corresponding default value. You cannot use the Null data type as a type annotation.
◆ Number data type
In ActionScript3.0, the Number data type can represent integers, unsigned integers, and floating-point numbers. However, to maximize performance, the Number data type should be used only for floating-point numbers, or for integer values larger than 32 bits that can be stored by int and uint types. To store floating-point numbers, the number should include a decimal point. If you omit the decimal point, the number is stored as an integer.
The Number data type uses the 64-bit double-precision format specified by the IEEE binary floating-point arithmetic standard (IEEE-754). This standard specifies how to use 64 available bits to store floating-point numbers. One digit is used to specify whether the number is positive or negative. 11 bits are used for exponents, which are stored in binary form. The remaining 52 bits are used to store "significant digits" (also known as "Mantissa"), where the significant digits are the N power of 2, and N is the index mentioned earlier.
You can use all bits of the Number data type for significant digits, or you can use some bits of the Number data type to store exponents, which can store much larger floating-point numbers. For example, if the Number data type uses all 64 bits to store significant digits, it can store 265-1 digits. If 11 of these bits are used to store the index, the * significant number that the Number data type can store is 21023.
The minimum and * * values that can be represented by the Number type are stored in static properties named Number.MAX_VALUE and Number.MIN_VALUE of the Number class.
Number.MAX_VALUE==1.79769313486231e+308Number.MIN_VALUE==4.940656458412467e-324 although this number range is large, the cost is that the precision of this range is reduced. The Number data type uses 52 bits to store significant digits, so numbers that require more than 52 digits to be accurately represented, such as the fraction 1 prime 3, will be approximate. If your application requires absolute precision for decimals, you need to use software that implements decimal floating-point arithmetic instead of binary floating-point arithmetic.
If you use the Number data type to store integer values, only 52 significant digits are used. The Number data type uses 52 bits and a special hidden bit to represent integers between-9007199254740992 (- 253) and 9007199254740992 (253).
FlashPlayer uses the nan value not only as the default value for variables of type Number, but also as the result of any operation that should return a number but does not. For example, if you try to calculate the square root of a negative number, the result will be NaN. Other special number values include "positive infinity" and "negative infinity".
Be careful
When divided by 0, if the divisor is also 0, then there is only one result, which is NaN. When divided by 0, if the divisor is positive, the result is positive infinity; if the divisor is negative, the result is negative infinity.
◆ String data type
The String data type represents a sequence of 16-bit characters. Strings are stored internally as Unicode characters and are formatted in UTF-16. Strings are immutable values, just like in the Java programming language. Performing an operation on a string value returns a new instance of the string. The default value for variables declared with the String data type is null. Although a null value and an empty string ("") indicate that there are no characters, they are not the same.
◆ uint data type
The uint data type is internally stored as a 32-bit unsigned integer, which contains a set of integers between 0 and 4294967295 (4294967295-1), including 0 and 4294967295. The uint data type can be used in special cases where non-negative integers are required. For example, you must use the uint data type to represent pixel color values because the int data type has an internal symbol bit that is not suitable for processing color values. For integer values greater than the * value of uint, you should use the Number data type, which can handle 53-bit integer values. The default value for variables of the uint data type is 0.
◆ void data type
The void data type in the Flex data type contains only one value: undefined. In earlier versions of ActionScript, undefined was the default value for instances of the Object class. In ActionScript3.0, the default value for Object instances is null. If you try to assign the value undefined to an instance of the Object class, FlashPlayer converts the value to null. You can only assign the value undefined to untyped variables. Untyped variables are variables that lack type annotations or use asterisks (*) as type annotations. Void can only be used as a return type comment.
◆ Object data type
The Object data type is defined by the Object class. The Object class is used as the base class for all class definitions in ActionScript. The Object data type in ActionScript3.0 differs from the Object data type in previous versions in the following three ways: * Object data type is no longer the default data type assigned to variables without type comments. Second, the Object data type no longer includes the value undefined, which used to be the default value for Object instances. Third, in ActionScript3.0, the default value for instances of the Object class is null.
In earlier versions of ActionScript, variables without type annotations were automatically assigned Object data types. ActionScript3.0 now includes the concept of truly untyped variables, so Object data types are no longer assigned to variables without type annotations. Variables without type comments are now treated as untyped variables. If you want to make it clear to the reader of the code that you deliberately leave the variable untyped, you can use the new asterisk (*) to indicate the type comment, which is equivalent to omitting the type comment. The following example shows two equivalent statements, both of which declare an untyped variable x:
Varx
Varx:*
Only untyped variables can hold the value undefined. If you try to assign the value undefined to a variable with a data type, FlashPlayer converts the value undefined to the default value for that data type. For instances of the Object data type, the default value is null, which means that if you try to assign undefined to an Object instance, FlashPlayer converts the value undefined to null.
The above is all the content of the article "what are the common Flex data types?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.