
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
tested on windowsxp and AIX, problem is portable
|
|
Issue Links:
|
Relate
|
|
|
|
This issue is related to:
|
|
|
|
|
|
|
|
| Planning Status: |
Unspecified
|
|
The Interbase documentation says that a float value should have a range from 1.175E-38 to 3.402E38. But, the largest value I can put in appears to be just under 3.4E38. 3.4E38 or higher results in overflow.
This came up when running the JDBC-CTS tests against Firebird embedded. Thanks go to my co-worker Dave M.
This was fixed in SAS Vulcan (S0275993). The code in jrd/cvt.cpp is using hard-coded 3.4E38 instead of the proper FLT_MAX symbol which is 3.402823466e+38F. Fix provided to Alex for review.
Here is bad test case:
create table float_test (i integer, f float);
insert into float_test values (1, 3.0);
insert into float_test values (1, 3.402823466e+38);
produces this output:
insert into float_test values (1, 3.402823466e+38);
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
Here is correct results with my patch:
SQL> create table float_test (i integer, f float);
SQL> insert into float_test values (1, 3.0);
SQL> insert into float_test values (1, 3.402823466e+38);
SQL> select * from float_test;
I F
============ ==============
1 3.0000000
1 3.4028235e+38
|
|
Description
|
The Interbase documentation says that a float value should have a range from 1.175E-38 to 3.402E38. But, the largest value I can put in appears to be just under 3.4E38. 3.4E38 or higher results in overflow.
This came up when running the JDBC-CTS tests against Firebird embedded. Thanks go to my co-worker Dave M.
This was fixed in SAS Vulcan (S0275993). The code in jrd/cvt.cpp is using hard-coded 3.4E38 instead of the proper FLT_MAX symbol which is 3.402823466e+38F. Fix provided to Alex for review.
Here is bad test case:
create table float_test (i integer, f float);
insert into float_test values (1, 3.0);
insert into float_test values (1, 3.402823466e+38);
produces this output:
insert into float_test values (1, 3.402823466e+38);
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
Here is correct results with my patch:
SQL> create table float_test (i integer, f float);
SQL> insert into float_test values (1, 3.0);
SQL> insert into float_test values (1, 3.402823466e+38);
SQL> select * from float_test;
I F
============ ==============
1 3.0000000
1 3.4028235e+38
|
Show » |
|
#ifdef FLT_MAX
#define FLOAT_MAX FLT_MAX /* Approx. 3.4e38 max float (32 bit) value */
#else
#define FLOAT_MAX 3.4e38 /* max float (32 bit) value */
#endif
Added not to forget after beta1.