Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Wed, 20 Nov 2002 @ 13:33:54 GMT

  <Prev Next>   <<First <Prev

Subj:   Re: Making a Sum Tbl. from a Detail Tbl. - Rounding
From:   Geoffrey Rommel

  Hi, I am creating a summurized table from a detail table, what do I need to take into account as far as rounding factors on number/decimal columns? Do I need to adjust the back ground decimal rounding to 4 or 5 instead of two? What else should I watch out for? Thanks, Jay  

Jay, I have not done this on my system, but I can mention two things you may want to watch out for.

(1) As you seem to be aware, the Teradata rounding rules (governed in part by RoundHalfwayMagUp) apply only to decimal fields. Integers are truncated; floating-point values are rounded by the Intel chip.

(2) Teradata tries to preserve the full precision of a product. If you multiply an integer by an integer, the result will have a type of integer; if you multiply a decimal(9,2) by a decimal(9,2), the result will have a type of decimal(18,4); and so on. Division, however, is different: since the result of a division can have an infinite number of digits (e.g. 1/7), only a relatively small number of places is preserved. (For the details, see the SQL Reference, Vol. 5, p. 2-3.) If a division occurs somewhere in the middle of a calculation, this can result in fairly large rounding errors.

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