Use PowerShell to round numbers

This one is easy. Normally, a division operation would yield a floating number in PowerShell:

PS Data [07/04/2017 19:48:41]> 15/9
1.66666666666667

To round numbers, you can use the round() method from System.Math Class. Here’s an example:

PS Data [07/05/2017 10:32:05]> [Math]::Round(15/9)
2

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s