<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to rounded off after the decimal point  in "UINT_TO_REAL"</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/327889f9fd/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Runtime/thread/327889f9fd/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Runtime/thread/327889f9fd/</id><updated>2020-02-27T16:07:13.240000Z</updated><subtitle>Recent posts to rounded off after the decimal point  in "UINT_TO_REAL"</subtitle><entry><title>rounded off after the decimal point  in "UINT_TO_REAL"</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/327889f9fd/?limit=25#b4f7" rel="alternate"/><published>2020-02-27T16:07:13.240000Z</published><updated>2020-02-27T16:07:13.240000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.comef1cb0e4a306fcfe334e4358de40075141ce1945</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; phenixrb&lt;/p&gt;
&lt;p&gt;HI,I-Campbell&lt;/p&gt;
&lt;p&gt;thanks for your answer, that's what I was looking for.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>rounded off after the decimal point  in "UINT_TO_REAL"</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/327889f9fd/?limit=25#f72f" rel="alternate"/><published>2020-02-27T16:07:12.443000Z</published><updated>2020-02-27T16:07:12.443000Z</updated><author><name>dFx</name><uri>https://forge.codesys.com/u/dfx/</uri></author><id>https://forge.codesys.comce5075ac437c723e0c0f7042de3bcfd4af8a3814</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Actually there is a type inconsistency in your formula :&lt;br/&gt;
LREAL:=UINT_TO_LREAL(UINT (I beg))/&lt;strong&gt;INT&lt;/strong&gt;*REAL&lt;/p&gt;
&lt;p&gt;Then, REAL/LREAL are stored and interpreted (IEEE float format &lt;a class="" href="https://en.wikipedia.org/wiki/Double-precision_floating-point_format" rel="nofollow"&gt;https://en.wikipedia.org/wiki/Double-precision_floating-point_format&lt;/a&gt;). That's why your values can't be exactly the same.&lt;/p&gt;
&lt;p&gt;If you need to get back your precise value, then I would suggest working with DINT and using scaling (*100) for you math.&lt;/p&gt;
&lt;p&gt;The type you need is called DECIMAL, but as far as I know, isn't supported in automation systems.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>rounded off after the decimal point  in "UINT_TO_REAL"</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/327889f9fd/?limit=25#47e2" rel="alternate"/><published>2020-02-27T16:07:11.636000Z</published><updated>2020-02-27T16:07:11.636000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.comf9341b7a4ae090ace7d8424b289bbe83fb917be7</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; D. Kugler&lt;/p&gt;
&lt;p&gt;you can use the TO_DINT funktion to throw all decimals away, so before &lt;em&gt;100.0 afterwords /100.0:&lt;br/&gt;
AIN01R:= TO_LREAL(TO_DINT(AIN01&lt;/em&gt;100.0)/100.0);&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>rounded off after the decimal point  in "UINT_TO_REAL"</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/327889f9fd/?limit=25#055a" rel="alternate"/><published>2020-02-27T16:07:09.361000Z</published><updated>2020-02-27T16:07:09.361000Z</updated><author><name>i-campbell</name><uri>https://forge.codesys.com/u/i-campbell/</uri></author><id>https://forge.codesys.comaf10a6c60c6ed1b6b45bda54d2971889050014c5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Tools &amp;gt; Options &amp;gt; Text Editor &amp;gt; Monitoring &amp;gt; Number of displayed digits&lt;br/&gt;
&lt;a class="" href="https://help.codesys.com/webapp/_cds_dlg_options_text_editor;product=codesys;version=3.5.15.0" rel="nofollow"&gt;https://help.codesys.com/webapp/_cds_dl ... n=3.5.15.0&lt;/a&gt; m &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>rounded off after the decimal point  in "UINT_TO_REAL"</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/327889f9fd/?limit=25#ec75" rel="alternate"/><published>2020-02-27T16:07:08.547000Z</published><updated>2020-02-27T16:07:08.547000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.comecbaaef2041584851ad90a73a352fc90652fd971</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; phenixrb&lt;/p&gt;
&lt;p&gt;Hello everyone ,&lt;/p&gt;
&lt;p&gt;I need help with rounding, in "UINT_TO_LREAL" conversions.&lt;br/&gt;
how is it possible to recover the unrounded values as in the upper table?&lt;/p&gt;
&lt;p&gt;and why, all are not rounded, for example the value "1.22"?&lt;/p&gt;
&lt;p&gt;at best, I would like to be able to use values to 2 decimal after the decimal point, like the value "1.22".&lt;/p&gt;
&lt;p&gt;thank you.&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: arrondis MCP3008.jpg" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=5140"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>