Converting VBScript's CSng Function
Definition: Returns an expression that has been converted to a Variant of subtype Single.
If you’ve read this conversion guide from the very beginning then you already know way more about data types than you probably wanted to know. Nevertheless, here’s yet another fact about data types: a single value is “a single-precision, floating-point number in the range -3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values.” Can you convert a variable to the single data type? The following two commands argue that you can. In the first command we assign a value to the variable $a; in the second command we convert $a to the single data type:
$a = "11.45" $a = [single] $a
When you run these commands and then use the GetType() method to return the data type for $a you should get the following:
IsPublic IsSerial Name -------- -------- ---- True True Single