- <#
- .SYNOPSIS
- This script displays dynamic properties of a BigInteger
- .DESCRIPTION
- This script demonstates the properties on an instance of BigInteger
- .NOTES
- File Name : Get-BigIntegerProperties.ps1
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : PowerShell Version 2.0
- .NET Framework 4
- .LINK
- This script posted to:
- http://www.pshscripts.blogspot.com
- MSDN Sample posted at:
- http://msdn.microsoft.com/en-us/library/system.numerics.biginteger_properties.aspx
- .EXAMPLE
- PSH [c:\foo]: .\Get-BigIntegerProperties.ps1
- Big Integer from 4096:
- IsPowerOfTwo : True
- IsZero : False
- IsOne : False
- IsEven : True
- Sign : 1
- #>
- # Add the .NET Version 4 System.Numerics.DLL
- Add-Type -Path "C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Numerics.dll"
- # Create a big integer then display it's key properties
- $BigInt = New-object System.Numerics.BigInteger 4096
- "Big Integer from 4096:"
- $BigInt | fl *
This blog contains PowerShell scripts, more PowerShell scripts and still more PowerShell scripts. Occasionally you may see some organisational posts.
Showing posts with label BigInteger. Show all posts
Showing posts with label BigInteger. Show all posts
Sunday, 1 August 2010
Get-BigIntegerProperties.ps1
Labels:
.Net 4.0,
BigInteger,
powershell,
PowerShell scripts,
System.Numerics
Saturday, 31 July 2010
New-BigInteger.ps1
- <#
- .SYNOPSIS
- This script creates and displays a BigInteger.
- .DESCRIPTION
- This script is a rewrite of an MSDN sample.
- .NOTES
- File Name : New-BigInteger.ps1
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : PowerShell Version 2.0
- .NET Framework 4
- .LINK
- This script posted to:
- http://pshscripts.blogspot.com/2010/07/new-bigintegerps1.html
- MSDN Sample posted at:
- http://msdn.microsoft.com/en-us/library/system.numerics.biginteger.aspx
- .EXAMPLE
- PSH [c:\foo]: .\Get-BigInteger.ps1
- Big Integer from 179032.6541:
- 179,032
- Big Integer from 1234934157136952:
- 1,234,934,157,136,952
- #>
- # Add the .NET Version 4 System.Numerics.DLL
- Add-Type -Path "C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Numerics.dll"
- # Create first big integer then display it nicely
- $BigIntFromDouble = New-Object System.Numerics.BigInteger 179032.6541
- "Big Integer from 179032.6541:"
- $BigIntFromDouble.ToString("N0")
- #Create second big integer then display it nicely
- $BigIntFromInt64 = New-object System.Numerics.BigInteger 1234934157136952
- "Big Integer from 1234934157136952:"
- $Bigintfromint64.tostring("N0")
Labels:
.Net 4.0,
BigInteger,
powershell,
PowerShell scripts,
System.Numerics
Subscribe to:
Posts (Atom)