Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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?

asked 06 Jun '12, 01:13

Sergey's gravatar image

accept rate: 0%

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


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).

permanent link

answered 06 Jun '12, 04:11

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

edited 06 Jun '12, 04:24

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 ((

(06 Jun '12, 04:22) Sergey
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 06 Jun '12, 01:13

question was seen: 15,109 times

last updated: 06 Jun '12, 04:24