Export (0) Print
Expand All
Expand Minimize
1 out of 3 rated this helpful - Rate this topic

Converting VBScript's CDbl Function


Windows PowerShell


Definition: Returns an expression that has been converted to a Variant of subtype Double.

CDbl

The double data type “contains a double-precision, floating-point number in the range -1.79769313486232E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values.”

Whew.

If it turns out you need a double-precision, floating-point number like that you can use Windows PowerShell to convert a variable to the double data type. The following two commands assign a string value to the variable $a, then convert $a to the double data type:


$a = "11.45"
$a = [double] $a

If you run these two commands and then use the GetType() method against $a you should get back the following information:


IsPublic IsSerial Name
-------- -------- ----
True     True     Double


Return to the VBScript to Windows PowerShell home page

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.