Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell to Round Numbers

$
0
0

Summary: Learn how to use Windows PowerShell to round numbers.

Hey, Scripting Guy! Question Is there an easy way to use Windows PowerShell to round numbers up or down in a computation that produces a large amount of numbers after the decimal point?

Hey, Scripting Guy! Answer Use the static Round method from the [math] class:

PS C:\> $a = 22/7

PS C:\> $a

3.14285714285714

PS C:\> [math]::Round($a)

3

PS C:\>


Viewing all articles
Browse latest Browse all 3333

Trending Articles