Rounding Numbers in PowerShell


Rounding Numbers in PowerShell

$Number = 13.5

Cropping:

[math]::Truncate($Number)

13

Rounding Down:

[math]::Floor($Number)

13

Rounding Up:

[math]::ceiling($Number)

14

Standard 0-4 Round Down 5-9 Round Up:

[math]::Round($Number)

14