conv:doubleToFloat

Converts an XSD double string value to an XSD float string value.

Namespace declaration

  • XSLT
    xmlns:conv="xalan://com.ibm.wbiserver.transform.util.MapUtils"
  • XQuery
    declare namespace conv="xalan://com.ibm.wbiserver.transform.util.MapUtils";

Syntax

conv:doubleToFloat(val, defaultValue)

Parameters

val
Specifies the double string value to convert.
defaultValue
Specifies a default float string value.

Guidelines

The conv:doubleToFloat function returns the default value under either of the following conditions.
  • The incoming string is an invalid XSD double string value.
  • The double string value cannot be converted to a float string value.

Converting from a double to a float can cause precision loss because a double stores more decimal places than a float. However, there might also be loss of data cause by truncation because the double can hold a much larger number than a float.

Results

Returns the converted value.