Click or drag to resize

FloatFormat Function

X#
Set the display format for a floating point numeric.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION FloatFormat(
	fValue AS FLOAT,
	iLen AS LONG,
	iDec AS LONG
) AS FLOAT
Request Example View Source

Parameters

fValue
Type: Float
Any numeric value.
iLen
Type: Long
The desired length of the display of fValue, including decimal digits, decimal point, and sign.
A value of -1 means that only significant digits to the left of the decimal point will be displayed (any left padding will be suppressed).
iDec
Type: Long
The desired number of decimal digits in the display of fValue.
A value of -1 means that only significant digits to the right of the decimal point will be displayed (any right padding will be suppressed).

Return Value

Type: Float
Remarks
FloatFormat() is used to format floating point numbers. Note that FloatFormat() affects only the display format of numbers and not the actual numeric precision of calculations.
Examples
These examples use FloatFormat() to display the same number using three different formats. Note the number of leading spaces in each result:
X#
1? FloatFormat(1234.546, 12,2)        //  1234.54
2? FloatFormat(1234.546, -1,4)        //  1234.5460
3? Floatformat(1234.546, 12,-1)        //  1234.546
See Also