OpenersNotesSection(Spacer1)Details

If the data on the link corresponds to a C int, MLGetReal64() will coerce it to a double before storing it in x.

If the data on the link corresponds to a number outside the range that can be stored in a C double on your computer system, then MLGetReal64() will fail, and return 0.

Arbitrary-precision real numbers are transmitted between MathLink programs as the number sequence generated by (RefLink[RealDigits, paclet:ref/RealDigits]), typically as an integer array or as a C string of decimal characters. This sequence can be read using (NonWLLink[MLGetInteger32List(), paclet:ref/c/MLGetInteger32List]) or (NonWLLink[MLGetString(), paclet:ref/c/MLGetString]).

MLGetReal64() returns 0 in the event of an error, and a nonzero value if the function succeeds.

Use (NonWLLink[MLError(), paclet:ref/c/MLError]) to retrieve the error code if MLGetReal64() fails.

MLGetReal64() is declared in the MathLink header file (RefLink[mathlink.h, paclet:ref/file/mathlink.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "mathlink.h"

/* read a double-precision floating-point number from a link */

void f(MLINK lp)
{
	double r;

	if(! MLGetReal64(lp, &r))
		{ /* unable to read the floating-point number from lp */ }

	/* ... */
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLGetReal32(), paclet:ref/c/MLGetReal32])  ▪  (NonWLLink[MLGetReal128(), paclet:ref/c/MLGetReal128])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}})}})