Oracle 10g introduces the new IEEE floating-point types BINARY_FLOAT
and BINARY_DOUBLE
. The types are extremely efficient for heavy floating point computations as the work is passed directly to the operating system. Literal assignments can be perfomed using the "f" and "d" suffixes or conversion functions TO_BINARY_FLOAT
and TO_BINARY_DOUBLE
:
DECLARE l_binary_float BINARY_FLOAT; l_binary_double BINARY_DOUBLE; BEGIN l_binary_float := 1.1f; l_binary_double := 1.00001d; l_binary_float := TO_BINARY_FLOAT(1.1); l_binary_double := TO_BINARY_DOUBLE(1.00001); END; |
Rather than raise exceptions, the resulting values of computations may equate to the following constants that can be tested for:
[BINARY_FLOAT|BINARY_DOUBLE]_NAN
[BINARY_FLOAT|BINARY_DOUBLE]_INFINITY
[BINARY_FLOAT|BINARY_DOUBLE]_MAX_NORMAL
[BINARY_FLOAT|BINARY_DOUBLE]_MIN_NORMAL
[BINARY_FLOAT|BINARY_DOUBLE]_MAX_SUBNORMAL
[BINARY_FLOAT|BINARY_DOUBLE]_MIN_SUBNORMAL
Fonte: http://www.oracle-base.com/articles/10g/PlsqlEnhancements10g.php
Nenhum comentário :
Postar um comentário