<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Formatting real data type into strings (not visualization)</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/57012872a9/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/57012872a9/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/57012872a9/</id><updated>2020-02-27T20:21:53.263000Z</updated><subtitle>Recent posts to Formatting real data type into strings (not visualization)</subtitle><entry><title>Formatting real data type into strings (not visualization)</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/57012872a9/?limit=25#a164" rel="alternate"/><published>2020-02-27T20:21:53.263000Z</published><updated>2020-02-27T20:21:53.263000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.come10b05dd4be0bd78683c609e5e42026304272ced</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;multiply your number by 100 to get two decimals&lt;br/&gt;
make a real_to_int conversion&lt;br/&gt;
this you can write direct to your CSV (as this will only take little memory&lt;br/&gt;
or divide it by 100 and make it a real again.&lt;br/&gt;
I do leave it in INT as my calc (openoffice) will calculate it back in correct numbers.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Formatting real data type into strings (not visualization)</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/57012872a9/?limit=25#8a61" rel="alternate"/><published>2020-02-27T20:21:51.915000Z</published><updated>2020-02-27T20:21:51.915000Z</updated><author><name>vader1000</name><uri>https://forge.codesys.com/u/vader1000/</uri></author><id>https://forge.codesys.com05d415e6b04910b40583cf14d6ac824da571e2af</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I need to get my floats into strings in the format I want.  I want to specify # of decimals.  This data is being logged to a .csv file.  The only option I appear to have is REAL_TO_STRING, then screw around with the resulting string.  The biggest problem I have now is that values &amp;lt; 1.0 are coming in as engineering format... so I get -9.733445E-1 for example.&lt;/p&gt;
&lt;p&gt;What is the correct solution to this situation?  Everything in Codesys seems to be built on C building blocks so why can't I just do a sprintf type of funciton and specify %.2f or something like that?&lt;/p&gt;
&lt;p&gt;Any help is appreciated.  I really don't feel like parsing out E values in my string to try to figure out where to move decimals around.  It's really getting excessive for something so simple.  I already have a ton of code to get the # of decimals I want with values that don't have E in them.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>