Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 16 Feb 2015 @ 09:49:50 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Casting to integer with ** operator resulting incorrect
 
From:   Frydryszak, Marek

Difference between cast to integer and cast to decimal decimal is a result of general rule:

Truncation and Rounding During Conversion

Conversion of DECIMAL/NUMERIC to BIGINT, INTEGER, BYTEINT, or SMALLINT

truncates any decimal portion. Conversion to DECIMAL produces a rounded result.

Difference between power function and operator: function is Oracle-compatible and returns type NUMBER ( for integer arguments), operator always returns float and arguments are converted to float before calculation.

If you use power function with float arguments, you will get result type float with the same value:

     sel  cast(  power(  10(float)  ,  4(float)  )     as integer )  : 9999


     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023