FLOAT


The FLOAT function returns a floating-point representation of a number.

FLOAT.png


The arguments are defined as follows:

numericExpression

The numeric expression is converted to a floating point number of length (8) from one of the following numerical data types:

  • SMALLINT
  • INTEGER
  • BIGINT
  • FLOAT
  • REAL
  • DECIMAL
  • DECFLOAT
  • @ROWID

Decimal precision might be lost because a floating-point number is not an exact representation of a decimal field.

stringExpression

If the argument is a string expression, it can be in any external numerical format. It is first converted to its corresponding format, and then converted to a float. If the CCSID of the string is not in EBCDIC encoding scheme, the CCSID is cast to EBCDIC CCSID(37) before conversion takes place.

Float is capable of converting the value returned by the internal @ROWID function into a floating-point value between 0 and 1. This value can be used to generate random numbers.

precision

The precision can be either short (16) or long (34).


Warning

Important

If the argument can be null, the result can be null; if the argument's value is null, the result is the null value.


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC AMI Load for Db2 13.1