Share

Rounding Differences Between Teradata and Snowflake

Rounding Differences Between Teradata and Snowflake
design1

One of the smallest but most persistent sources of data mismatches during a Teradata-to-Snowflake migration comes from an unassuming function: ROUND().

While both systems follow ANSI SQL semantics, they differ in how they handle values that lie exactly halfway between two rounding candidates (i.e., when the digit after the rounding precision is 5).


Standard Rounding (Half-Up)

Snowflake uses the standard half-up rounding rule.


Want more practical data engineering analysis like this?

Join DWHPro Letters and get field-tested notes on Teradata, Snowflake, AI, migrations, performance, and enterprise data work. DWHPro Letters is free. Subscribe to get new issues by email.

Get the next issue


When the digit after the precision is 5 or greater, the number is always rounded away from zero.

ValueRounded (1 decimal)
1.241.2
1.251.3
1.261.3

This method is simple and intuitive. However, when applied repeatedly over large datasets, it introduces a slight upward bias, as all halfway cases round in the same direction.


Banker’s Rounding (Half-to-Even)

Teradata’s default is Banker’s rounding, also known as half-to-even.

In this method, when the digit after the precision is exactly 5, the result is rounded toward the nearest even last digit. This minimizes cumulative bias in aggregates.

ValueRounded (1 decimal)Explanation
1.251.21.3 would make the last digit odd → round down
1.351.41.4 is even → round up
1.451.41.5 would be odd → round down

In practice, this produces slightly different results for .5 values only.


Teradata Configuration

The behavior can be controlled through the DBS parameter:

Get the next issue by email.
MODIFY DBS ROUNDHALFWAYMAGUP = TRUE | FALSE;

SettingBehaviorDescription
FALSE (default)Banker’s roundingHalf-to-even
TRUEStandard roundingHalf-up (like Snowflake)

Therefore:

  • Default Teradata: 1.25 → 1.2
  • Snowflake: 1.25 → 1.3

Unless this parameter was explicitly modified, most Teradata systems use Banker’s rounding.


Emulating Banker’s Rounding in Snowflake

Snowflake has no configuration parameter for rounding behavior.

However, equivalent results can be achieved with a short SQL function:

CREATE OR REPLACE FUNCTION BANKERS_ROUND(v NUMBER, s INT)
RETURNS NUMBER
LANGUAGE SQL
AS
$$
  CASE
    WHEN ABS(v*POWER(10,s) - ROUND(v*POWER(10,s))) = 0.5
      THEN SIGN(v) *
           (CASE WHEN MOD(TRUNC(ABS(v*POWER(10,s))),2)=0
                   THEN TRUNC(ABS(v*POWER(10,s)))
                   ELSE TRUNC(ABS(v*POWER(10,s)))+1
            END) / POWER(10,s)
    ELSE ROUND(v, s)
  END
$$;

Example

SELECT
  v,
  ROUND(v,1) AS standard_round,
  BANKERS_ROUND(v,1) AS bankers_round
FROM VALUES (1.05),(1.25),(1.35),(1.45),(1.55);

vStandard (Snowflake)Banker’s (Teradata)
1.251.31.2
1.351.41.4
1.451.51.4

Only exact halfway values (.5) are affected.


When the Difference Matters

For most datasets, the difference is negligible.

However, in financial or statistical reporting systems—where consistency with historical Teradata behavior is mandatory—the distinction becomes important.

ValueTeradataSnowflakeSame?
1.211.21.2
1.271.31.3
1.251.21.3

If you rarely encounter .5 values, the two systems will behave identically.


Migration Guidelines

AspectTeradataSnowflakeAction
Default behaviorBanker’s (half-to-even)Standard (half-up)Review .5 rounding logic
Configurable✅ via ROUNDHALFWAYMAGUPUse UDF if equivalence required
1.25 result1.21.3Replace ROUND() with BANKERS_ROUND()
Bias tendencyNeutralSlight upwardValidate totals and aggregates

Checklist:

  1. Check the value of ROUNDHALFWAYMAGUP on your Teradata system.
  2. If it’s FALSE, implement the BANKERS_ROUND() UDF in Snowflake.
  3. If it’s TRUE, Snowflake’s native rounding matches.
  4. Validate all .5 boundaries before sign-off.

Conclusion

Rounding differences rarely cause major migration issues—but they can quietly distort totals and audit reports if overlooked.

Understanding how Teradata’s half-to-even logic differs from Snowflake’s half-up approach ensures mathematical consistency and protects data integrity during migration.


Planning or surviving an enterprise data platform migration?

I write regularly about the performance, cost, architecture, and project mistakes that show up in real Teradata, Snowflake, Databricks, and enterprise data work.

Subscribe for free and keep launch access.

Written by Roland Wenzlofsky, founder of DWHPro and author of Teradata Query Performance Tuning. DWHPro has helped data warehouse practitioners for 15+ years.

Subscribe to DWHPro Letters

Practical field notes on enterprise data engineering, production AI systems, platform migration, and the senior engineering market.
Written by Roland Wenzlofsky Founder of DWHPro Author of Teradata Query Performance Tuning
Get the next issue
Subscribe