public static function ToDouble( $value, $provider = null )
	{
		if ( $value instanceof \DateTime )
		{
			return NAN; // $value->getTimestamp() + 0.0;
		}
		else if ( ( is_numeric( $value ) && $value == INF ) || ( is_string( $value ) && strtoupper( $value ) == "INF" ) )
		{
			return INF;
		}
		else if ( ( is_numeric( $value ) && $value == -INF ) || ( is_string( $value ) && strtoupper( $value ) == "-INF" ) )
		{
			return -INF;
		}
		if ( $x = ( is_numeric( $value ) && is_nan( $value ) ) || ( is_string( $value ) && strtoupper( $value ) == "NAN" ) )
		{
			return NAN;
		}
		else if ( $value instanceof DecimalValue )
		{
			return $value->ToDouble( $provider );
		}
		else if ( is_object( $value ) )
		{
			$text = "unknown";

			if ( $value instanceof ValueProxy )
			{
				/**
				 * @var ValueProxy $proxy
				 */
				$proxy = $value;
				return $proxy->ToDouble( $provider );
			}
			else if ( $value instanceof XPath2Item || $value instanceof Integer )
			{
				return $value->ToDouble( $provider );
			}
			else if ( $value instanceof UntypedAtomic )
			{
				$text = $value->__toString();
				if ( is_numeric( $text ) ) return $text + 0.0;
			}

			throw XPath2Exception::withErrorCodeAndParams( "FORG0001", Resources::FORG0001, array( $text, "xs:Double" ) );

		}
		else if ( is_numeric( trim( $value ) ) )
		{
			// This is an alternative multi-regional implementation to convert number strings
			// $locale = \Collator::create( null )->getLocale( \Locale::VALID_LOCALE );
			// $fmt = new \NumberFormatter( $locale, \NumberFormatter::DECIMAL );
			// $num = $fmt->parse( $this->Value );
			// if ( $num )
			// {
			// 	if ( $num == 0 ) $num = 0.0;
			// 	$this->_doubleValue = $num;
			// 	return true;
			// }

			return trim( $value ) + 0.0;
		}

		return null;
	}
public static function ToDouble( $value, $provider = null )
	{
		if ( $value instanceof \DateTime )
		{
			return NAN; // $value->getTimestamp() + 0.0;
		}
		else if ( ( is_numeric( $value ) && $value == INF ) || ( is_string( $value ) && strtoupper( $value ) == "INF" ) )
		{
			return INF;
		}
		else if ( ( is_numeric( $value ) && $value == -INF ) || ( is_string( $value ) && strtoupper( $value ) == "-INF" ) )
		{
			return -INF;
		}
		if ( $x = ( is_numeric( $value ) && is_nan( $value ) ) || ( is_string( $value ) && strtoupper( $value ) == "NAN" ) )
		{
			return NAN;
		}
		else if ( $value instanceof DecimalValue )
		{
			return $value->ToDouble( $provider );
		}
		else if ( is_object( $value ) )
		{
			$text = "unknown";

			if ( $value instanceof ValueProxy )
			{
				/**
				 * @var ValueProxy $proxy
				 */
				$proxy = $value;
				return $proxy->ToDouble( $provider );
			}
			else if ( $value instanceof XPath2Item || $value instanceof Integer )
			{
				return $value->ToDouble( $provider );
			}
			else if ( $value instanceof UntypedAtomic )
			{
				$text = $value->__toString();
				if ( is_numeric( $text ) ) return $text + 0.0;
			}

			throw XPath2Exception::withErrorCodeAndParams( "FORG0001", Resources::FORG0001, array( $text, "xs:Double" ) );

		}
		else if ( is_numeric( trim( $value ) ) )
		{
			// This is an alternative multi-regional implementation to convert number strings
			// $locale = \Collator::create( null )->getLocale( \Locale::VALID_LOCALE );
			// $fmt = new \NumberFormatter( $locale, \NumberFormatter::DECIMAL );
			// $num = $fmt->parse( $this->Value );
			// if ( $num )
			// {
			// 	if ( $num == 0 ) $num = 0.0;
			// 	$this->_doubleValue = $num;
			// 	return true;
			// }

			return trim( $value ) + 0.0;
		}

		return null;
	}
public static function ToDouble ( $ value , $ provider = null ) { if ( $ value instanceof \ DateTime ) { return NAN ; // $value->getTimestamp() + 0.0;
 } else if ( ( is_numeric ( $ value ) && $ value == INF ) || ( is_string ( $ value ) && strtoupper ( $ value ) == "INF" ) ) { return INF ; } else if ( ( is_numeric ( $ value ) && $ value == - INF ) || ( is_string ( $ value ) && strtoupper ( $ value ) == "-INF" ) ) { return - INF ; } if ( $ x = ( is_numeric ( $ value ) && is_nan ( $ value ) ) || ( is_string ( $ value ) && strtoupper ( $ value ) == "NAN" ) ) { return NAN ; } else if ( $ value instanceof DecimalValue ) { return $ value -> ToDouble ( $ provider ) ; } else if ( is_object ( $ value ) ) { $ text = "unknown" ; if ( $ value instanceof ValueProxy ) { /**
				 * @var ValueProxy $proxy
				 */ $ proxy = $ value ; return $ proxy -> ToDouble ( $ provider ) ; } else if ( $ value instanceof XPath2Item || $ value instanceof Integer ) { return $ value -> ToDouble ( $ provider ) ; } else if ( $ value instanceof UntypedAtomic ) { $ text = $ value -> __toString ( ) ; if ( is_numeric ( $ text ) ) return $ text + 0.0 ; } throw XPath2Exception :: withErrorCodeAndParams ( "FORG0001" , Resources :: FORG0001 , array ( $ text , "xs:Double" ) ) ; } else if ( is_numeric ( trim ( $ value ) ) ) { // This is an alternative multi-regional implementation to convert number strings
 // $locale = \Collator::create( null )->getLocale( \Locale::VALID_LOCALE );
 // $fmt = new \NumberFormatter( $locale, \NumberFormatter::DECIMAL );
 // $num = $fmt->parse( $this->Value );
 // if ( $num )
 // {
 // 	if ( $num == 0 ) $num = 0.0;
 // 	$this->_doubleValue = $num;
 // 	return true;
 // }
 return trim ( $ value ) + 0.0 ; } return null ; }
Converts the value of this instance to an equivalent double-precision floating-point
number using the specified culture-specific formatting information.

@param object $value The value to convert
@param IFormatProvider $provider An interface implementation that supplies culture-specific formatting information.
@return double A double-precision floating-point number equivalent to the value of this instance.
Converts the value of this instance to an equivalent double - precision floating - point number using the specified culture - specific formatting information .