Stripping Decimals Without Rounding
Extracting the Integer Part of a Division Result When you divide numbers and just want the decimals before the decimal point, you could cast the...
- Written By: ps1
- Last Updated: April 22, 2025
- 1 minute read
Extracting the Integer Part of a Division Result When you divide numbers and just want the decimals before the decimal point, you could cast the...
When you divide numbers and just want the decimals before the decimal point, you could cast the result to integer. However, this would also round the result:
PS> 18 / 5 3.6 PS> [Int](18/5) 4
PS> [Math]::Truncate(18/5) 3
Likewise, to manually round, use Floor() or Ceiling().
ReTweet this Tip!
Contact our sales team to get a personalized demo of our database management software for SQL Server!