DECFLOAT underflow should yield zero instead of an error
--------------------------------------------------------

                 Key: CORE-5700
                 URL: http://tracker.firebirdsql.org/browse/CORE-5700
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 4.0 Alpha 1
            Reporter: Mark Rotteveel


A DECFLOAT underflow (that is if the exponent is smaller than the minimum 
supported exponent), currently yields an error. However, based on the rules in 
SQL:2016 5.3 <literal> and 6.13 <cast specification>, this should instead yield 
0 (either really 0E0, or maybe 0E<lowest valid exponent>).

Specifically from 5.3 (full quote below): ""Underflow", i.e., specifying a 
nonzero value so close to 0 (zero) that the closest representation in the 
SQL-implementation's internal representation is 0E0, is a special case of the 
latter condition, and is not a syntax error"

====
*** IBPP::SQLException ***
Context: Statement::Fetch
Message: isc_dsql_fetch failed.

SQL Message : -901
Unsuccessful execution caused by system error that does not preclude successful 
execution of subsequent statements

Engine Code    : 335545143
Engine Message :
Decimal float underflow.  The exponent of a result is less than the magnitude 
allowed.
====

"""
23) It is implementation-defined whether the declared type of an <approximate 
numeric literal> ANL is an implementation-defined approximate numeric type or 
the decimal floating-point type with an implementation-defined precision. If 
the declared type of ANL is an approximate numeric type, then the value of ANL 
shall not be greater than the maximum value nor less than the minimum value 
that can be represented by the approximate numeric types. If the declared type 
of ANL is the decimal floating-point type, then the value of ANL shall not be 
greater than the maximum value nor less than the minimum value that can be 
represented by the decimal floating-point type.

NOTE 142 — Thus the only syntax error for an <approximate numeric literal> is 
what is commonly known as "overflow"; there is no syntax error for specifying 
more significant digits than the SQL-implementation can represent internally, 
nor for specifying a value that has no exact equivalent in the 
SQL-implementation's internal representation. ("Underflow", i.e., specifying a 
nonzero value so close to 0 (zero) that the closest representation in the 
SQL-implementation's internal representation is 0E0, is a special case of the 
latter condition, and is not a syntax error.)
"""

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to