From 8a33a0561055e05fb3806942cc3a1222b9f1a5ea Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Mon, 28 Oct 2024 14:12:31 +0100 Subject: [PATCH] Renamed to write-pi.ps1 --- scripts/{list-pi.ps1 => write-pi.ps1} | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename scripts/{list-pi.ps1 => write-pi.ps1} (79%) diff --git a/scripts/list-pi.ps1 b/scripts/write-pi.ps1 similarity index 79% rename from scripts/list-pi.ps1 rename to scripts/write-pi.ps1 index ccf1eccc..51d45941 100755 --- a/scripts/list-pi.ps1 +++ b/scripts/write-pi.ps1 @@ -1,12 +1,12 @@ <# .SYNOPSIS - Lists PI + Writes PI .DESCRIPTION - This PowerShell script calculates and lists the digits of the mathematical constant PI. + This PowerShell script calculates and writes the digits of the mathematical constant PI. .PARAMETER digits Specifies the number of digits to list (1000 by default) .EXAMPLE - PS> ./list-pi.ps1 + PS> ./write-pi.ps1 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342... .LINK https://github.com/fleschutz/PowerShell @@ -14,9 +14,9 @@ Author: Markus Fleschutz | License: CC0 #> -param([int]$Digits = 1000) +param([int]$digits = 1000) -function List-Pi ( $Digits ) { +function Write-Pi ( $digits ) { $Big = [bigint[]](0..10) $ndigits = 0 @@ -43,7 +43,7 @@ function List-Pi ( $Digits ) { $q *= $Big[10] $r = $nr - while ($ndigits -lt $Digits) { + while ($ndigits -lt $digits) { if ($Big[4] * $q + $r - $t -lt $n * $t) { Write-Host "$n" -noNewline $ndigits++ @@ -62,11 +62,11 @@ function List-Pi ( $Digits ) { $r = $nr } } - Write-Host "... ($Digits digits)" + Write-Host "... ($digits digits)" } try { - List-Pi $Digits + Write-Pi $digits exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"