eine Funktion Gegeben: function log2 {param ([double]$x) [Math]::Log($x)/[Math]::Log(2) }
Warum interpretiert Powershell log2 45/120 als log2 "45/120"?
Erwartet: log2 45/120
Ausbeute -1.41503749928
Actual sollte: Cannot process argument transformation on parameter 'x'. Cannot convert value "45/120" to type "System.Double". Error: "Input string was not in a correct format." At line:1 char:6 + log2 45/120 + ~~~~~~ + CategoryInfo : InvalidData: (:) [log2], ParameterBindingArgumentTransformationException + FullyQualifiedErrorId : ParameterArgumentTransformationError,log2
Warum ist das so?
kein Bug, [dies ist konstruktions] (https://docs.microsoft.com/en-us /powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-5.1) –