Search code examples
string-conversiontwincatcodesys

REAL / LREAL to String with Scientific Notation Structured Text


I am looking for a way to convert a floating-point value to scientific notaiton string in Beckhoff TwinCAT or codesys. The documentation for their FB_FormatString says this is not currently supported. Does anyone have a "goto" approach for this?


Solution

  • In TwinCAT I use LREAL_TO_FMTSTR

    sOut := LREAL_TO_FMTSTR( 0.46523, 2, TRUE );