What are the largest and smallest NUMBER values?

  • From: Jonathan Gennick <jonathan@xxxxxxxxxxx>
  • To: Oracle-L <oracle-l@xxxxxxxxxxxxx>(E-mail)
  • Date: Sun, 3 Apr 2005 21:47:56 -0400

I'm trying to nail down the range of NUMBER values. The range I come
up with, based on a maximum precision of 38 and a scale range of -84
through 127, is illustrated by the following code block:

DECLARE
   min_num NUMBER(38,127);
   max_num NUMBER(38,-84);
BEGIN
   /* 127 is largest scale, so begin with 1 and move
      decimal point 127 places to the left. Easy. */
   min_num := 1E-127;
   DBMS_OUTPUT.PUT_LINE(min_num);

   /* -84 is smallest scale value. Add 37 to normalize
      the scientific-notation, and we get E+121. */
   max_num := 9.9999999999999999999999999999999999999E+121;
   DBMS_OUTPUT.PUT_LINE(max_num);
END;
/

The results I get are:

1.000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000E-127
9.999999999999999999999999999999999999900000000000000000000000000000000000000000
000000000000000E+121

These results make sense to me. What troubles me is that the SQL
Reference gives 1.0E-130 as the low end (versus my 1.0E-127). The SQL
reference also gives "up to, but not including 1.0E126" as the high
end. It would seem that the manual is incorrect. On the other hand,
perhaps there is some subtle point that I am just not seeing. So I'm
throwing my question, and my code out to see whether anyone can spot a
flaw in my thinking here.

Best regards,

Jonathan Gennick --- Brighten the corner where you are
http://Gennick.com * 906.387.1698 * mailto:jonathan@xxxxxxxxxxx

Join the Oracle-article list and receive one
article on Oracle technologies per month by 
email. To join, visit http://five.pairlist.net/mailman/listinfo/oracle-article, 
or send email to Oracle-article-request@xxxxxxxxxxx and 
include the word "subscribe" in either the subject or body.

--
//www.freelists.org/webpage/oracle-l

Other related posts: