December 27th, 2014

PowerTip: Round Numbers with PowerShell

Doctor Scripto
Scripter

Summary: Easily use Windows PowerShell to round numbers.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily round numbers?

Hey, Scripting Guy! Answer Use the Round static method from the System.Math class, for example:

PS C:\> 22/7

3.14285714285714

PS C:\> [math]::Round(22/7)

3

PS C:\> 

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback