Float

The Float function converts an integer, string, or Boolean expression to a floating point number.

Syntax

The Float function has the following syntax:

Float = Float(Expression)

Parameters

The Float function has the following parameter.

Table 1. Float function parameters

Parameter

Format

Description

Expression

Integer | String | Boolean

Expression to be converted.

Return value

The converted floating point number.

Example

The following example shows how to convert integers, strings, and Boolean expressions to float point numbers using IPL.

MyFloat = Float(25);
Log(MyFloat);
					
MyFloat = Float("25.12");
Log(MyFloat);
					
MyFloat = Float(true);
Log(MyFloat);

This example prints the following message to the policy log:

Parser Log: 25.0
Parser Log: 25.12
Parser Log: 1.0

The following example shows how to convert integers, strings, and Boolean expressions to float point numbers using JavaScript.

MyFloat = Float(25);
Log(MyFloat);
					
MyFloat = Float("25.12");
Log(MyFloat);
					
MyFloat = Float(true);
Log(MyFloat);

JavaScript does not add any decimal points to the results for integers and Boolean expressions that are used with the Float function.

This example prints the following message to the policy log:

Parser Log: 25
Parser Log: 25.12
Parser Log: 1