SourcePoint Intel Help

Table of Contents

strtod

Convert a string into a real8 variable.

Syntax

[result =] strtod(string-expr)

Where:

result

specifies a debug variable of type real8 to which the function return value is assigned. If result is not specified, the return value is displayed on the next line of the screen.

string-expr

specifies an nstring variable or a quoted string constant.

Discussion

The function strtod expects the number to be converted to consist of:

  1. An optional plus or minus sign

  2. A sequence of decimal digits, possible containing a single decimal point

  3. An optional exponent part, consisting of the letter e or E, an optional sign, and a sequence of decimal digits

The conversion stops at the end of the string or after encountering an illegal character. If no conversion can be performed, then zero is returned.

Example 1

Command input:

strtod("1.2")

Result:

1.2

Example 2

Command input:

define real8 answer
answer=strtod("23.345")
answer

Result:

23.345

Example 3

Command input:

define nstring myString = "4.56 inches"
strtod(myString)

Result:

4.56

Related Topics: