Tabular IQ
Back to Function Index

TRUNC()

Overview

TRUNC() truncates a number to a specified precision by removing digits beyond the specified decimal places. If no precision is specified, TRUNC() returns the integer portion of the number. Unlike ROUND(), TRUNC() simply removes digits without rounding, making it useful for precise truncation operations.

Function Format

TRUNC(number [, precision])

Return Value

TRUNC() returns a numeric value

Examples


// Truncating to integer (no precision specified)
TRUNC(10.333) = 10
TRUNC(10.666) = 10
TRUNC(-10.333) = -10
TRUNC(-10.666) = -10

// Truncating to specific decimal places
TRUNC(10.333, 2) = 10.330
TRUNC(10.666, 2) = 10.660

// Additional examples
TRUNC(3.14159, 3) = 3.141    // Truncating π
TRUNC(100.999, 1) = 100.9    // Single decimal place
TRUNC(-5.678, 2) = -5.67     // Negative number with precision
TRUNC(0.12345, 4) = 0.1234   // Small number with precision

Notes

  • Important behaviors:
    • Removes digits without rounding
    • Default behavior returns integer portion
    • Preserves negative sign
    • Maintains specified decimal places
    • No rounding occurs
  • Common use cases include:
    • Financial calculations
    • Data truncation
    • Precision control
    • Number formatting
    • Statistical analysis
  • The function is useful for:
    • Removing decimal places
    • Controlling precision
    • Data standardization
    • Number formatting
  • Important considerations:
    • Different from ROUND() function
    • Preserves negative values
    • No rounding occurs
    • Precision parameter is optional

See Also