Oracle PL/SQL - BINARY_FLOAT and BINARY_DOUBLE

Introduction

BINARY_FLOAT and BINARY_DOUBLE data types are for high-speed scientific computations.

You shouldn't use BINARY_FLOAT and BINARY_DOUBLE data types for calculations where very high precision is required.

BINARY_FLOAT and BINARY_DOUBLE maintain only a limited number of digits.

Demo

SQL>
SQL> declare--  ww w .ja  v  a  2 s  .  c o m
  2      v_nr number;
  3  begin
  4      for i in 1..1000000 loop
  5          v_nr:=sqrt(i);
  6      end loop;
  7  end;
  8  /

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.53
SQL>
SQL> declare
  2      v_nr binary_float;
  3  begin
  4      for i in 1..1000000 loop
  5          v_nr:=sqrt(i);
  6      end loop;
  7  end;
  8  /

PL/SQL procedure successfully completed.

Elapsed: 00:00:02.42
SQL>

Related Topic