Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Sun, 15 Feb 2015 @ 15:20:54 GMT

  <Prev Next>  
Next> Last>>  

Subj:   Casting to integer with ** operator resulting incorrect
From:   Ganga, Sandeep Kumar

Hi Forum,

Power and ** function are results float data typed values.

## power(x, y): upon working function CAST to integer data type, it results correct.

## x**y : upon working function CAST to integer, it is resulting incorrect.

test case:

     select cast(power(10,4) as integer);  res:  10000

     select cast((10**4) as integer);      res:  9999

however it works when we use double cast through decimal,

     select cast(cast((10**4) as decimal(20,0))as integer);   res: 10000

Could anyone help me understand why this is happening ,is there any implicit conversion going on here.




  <Prev Next>  
Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 24 Jul 2020