Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 36188

PowerTip: Display the Value of Pi to Three Decimal Places

$
0
0

Summary: Use Windows PowerShell to display the value of Pi to three decimal places.

Hey, Scripting Guy! Question How can I display the value of Pi to three decimal places by using conditional formatting to avoid rounding numbers up or down?

Hey, Scripting Guy! Answer Use the Fixed-Point (“F”) Format Specifier, and specify the number of desired decimal places. The following technique uses the Windows PowerShell format operator.

PS C:\> "{0:F3}" -f [math]::PI

3.142

 


Viewing all articles
Browse latest Browse all 36188

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>