cancel
Showing results for 
Search instead for 
Did you mean: 

Float and double

Former Member
0 Kudos
15,306

Hi, a have a problem with float data type

i enter this code

create table #a(f float, d double)    
insert into #a values(20350.35, 20350.35)    
select * from #a

I see a different result in column f and d

f                d
20350.349609375 20350.35

i use SQL Anywhere 12. in early versions, such as ASA 8 was float_as_double option, that can solve this problem

is it bug?

Accepted Solutions (1)

Accepted Solutions (1)

VolkerBarth
Contributor

It is by design - cf. the v11.0.0 "SQL Anywhere deprecated and discontinued features" docs - to cite:

float_as_double

In SQL Anywhere, the FLOAT keyword never behaves like Adaptive Server Enterprise's FLOAT keyword when a precision is not specified. SQL Anywhere does not treat FLOAT values the same as DOUBLE values.

For Open Client and jConnect connections, this behavior is different from the default behavior in previous releases.

When unloading or connecting to older databases with materialized views, the setting of this option is ignored.

Without that option, a FLOAT without precision is equivalent to the REAL data type and requires 4 bytes of storage, whereas a DOUBLE requires 8 bytes.

So I guess you ought to bring the datatypes into line (or use FLOAT with an explicit precision, such as FLOAT(53) - that should be identical to DOUBLE).

Former Member
0 Kudos

i read about that, but unfortunately I do not have access to source code and I can not change table definition. it is temporary table, that creates inside program ((

Answers (0)