floatToStr (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

3.10 / 1.00.00


This function converts a FLOAT to a string.

 

Note: This function works with DOUBLE, but can also work with FLOAT as described in the Floating-point math introductory section.

 

Input:

v : FLOAT

Value to convert.

 

Returns: STRING

A string representation the value of v with 7 significant digits.

 

Declaration:

FUNCTION floatToStr : STRING;
VAR_INPUT
v : FLOAT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
INCLUDE math.inc
 
PROGRAM test;
 
DebugMsg(message := " sin(270) = " + floatToStr(v := sin(v := degToRad(v := 270.0))));
DebugMsg(message := " asin(1) = " + floatToStr(v := radToDeg(v := asin(v := 1.0))));
 
END_PROGRAM;