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.
TRUNC(number [, precision])
TRUNC() returns a numeric value
// 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