Quantcast
Channel: SCN: Message List - SAP SQL Anywhere
Viewing all articles
Browse latest Browse all 2182

Re: Divide 111 / 7

$
0
0

That interesting question shows the effect of default type conversions. Numeric constants may be interpreted diffently depending on their value.

 

Executing this statement

SELECT 111/7.0 AS singleprec, CAST (111/7.0 AS DOUBLE) double1prec, 111 / CAST (7.0 as DOUBLE) double2prec

 

gives the following results in ISQL (SQLA 12.0.1):

 

singleprec,double1prec,double2prec

15.86,15.8571,15.857142857142858

 

So it looks like the given values are interpreted as INTEGER and REAL respectively. The explict cast to DOUBLE has different effects when applied to the result or one operand.

 

Cf. the documentation dcx.sybase.com/index.html#1201/en/dbreference/dtco.html


Viewing all articles
Browse latest Browse all 2182

Trending Articles