All Products
Search
Document Center

TO_BINARY_FLOAT

Last Updated: Jun 18, 2021

The TO_BINARY_FLOAT function returns a 32-bit single-precision floating-point number.

Syntax

TO_BINARY_FLOAT(expr [, fmt [, 'nlsparam' ] ])

Parameters

Parameter

Description

expr

The string or the numeric data type: NUMBER, BINARY_FLOAT, or BINARY_DOUBLE.

The optional parameters fmt and nlsparam are valid only if expr is a string. They serve the same purpose as the TO_CHAR(number) feature. If expr is BINARY_FLOAT, the function returns expr.

Return type

A 32-bit single-precision floating-point number is returned. The result of converting a string or NUMBER to BINARY_FLOAT may be inexact. This is because NUMBER and character types use decimal precision to represent numeric values, but BINARY_FLOAT uses binary precision. If a BINARY_DOUBLE value uses higher precision than the precision that is supported by BINARY_FLOAT, the result of converting BINARY_DOUBLE to BINARY_FLOAT is inexact.

Examples

Execute the following statement:

SELECT TO_BINARY_FLOAT(1222.111) from dual;

The following query result is returned:

+---------------------------+
| TO_BINARY_FLOAT(1222.111) |
+---------------------------+
|           1.22211096E+003 |
+---------------------------+

You can refer to TO_BINARY_DOUBLE and TO_CHAR(number).