binary_float、binary_double 、number

 

 

Two new data types were introduced in Oracle: binary_float and binary_double. These two data types are complementary to the number data type.

Binary_float: Stores a single-precision 32-bit floating point number.

Binary_double: Stores a double-precision 64-bit floating point number.

number can store integers and decimals, but the data is formatted when storing decimals. For example, 283038.55803527 may become 283038.558035270016000 in the library. This is to take the data of type number (30,15) as an example.

 

Their advantages:

1. The required storage space is small: Binary_float needs 5 bytes, Binary_double needs 9 bytes, and number needs 32 bytes.

2. The range of numbers that can be represented is larger

3. Perform operations faster: binary_float and binary_double types usually perform operations in hardware, while number types are first converted using software before operations.

4. Operation encapsulation: Mathematical operations performed on binary_float and binary_double types are encapsulated, which means that the result is either a number or a special value.

5. Rounding is transparent: binary_float and binary_double types use binary to represent numbers, while number uses decimal to represent them.

 

Below are 4 special values ​​about binary_float and binary_double

<!-- [if gte mso 9]><xml><w:WordDocument><w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel><w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery><w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery><w:DocumentKind>DocumentNotSpecified</w:DocumentKind><w:DrawingGridVerticalSpacing>7.8</w:DrawingGridVerticalSpacing><w:View>Normal</w:View><w:Compatibility></w:Compatibility><w:Zoom>0</w:Zoom></w:WordDocument></xml><![endif]-->

special value

describe

Binary_float_nan

Numbers other than binary_float (nan)

Binary_float_infinity

Infinity (inf) of type Binary_float

Binary_double_nan

Numbers of types other than binary_double (nan)

Binary_double_infinity

Infinity (inf) of type Binary_double

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326711310&siteId=291194637