<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Result of multiplication always 16 bits?</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/67097c7eb3/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/67097c7eb3/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/67097c7eb3/</id><updated>2020-02-27T22:31:58.314000Z</updated><subtitle>Recent posts to Result of multiplication always 16 bits?</subtitle><entry><title>Result of multiplication always 16 bits?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/67097c7eb3/?limit=25#2ba3" rel="alternate"/><published>2020-02-27T22:31:58.314000Z</published><updated>2020-02-27T22:31:58.314000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com8f3e4adc4fc4713f69e0e11b5c05ebafc526ec5f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;not reaaly but you did not define the multiplication factor (2) as a byte thus this is automatic an integer thus the result is an integer.&lt;br/&gt;
define the 2 as a constant byte and you will see it works.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Result of multiplication always 16 bits?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/67097c7eb3/?limit=25#7e45" rel="alternate"/><published>2020-02-27T22:31:53.945000Z</published><updated>2020-02-27T22:31:53.945000Z</updated><author><name>astrand</name><uri>https://forge.codesys.com/u/astrand/</uri></author><id>https://forge.codesys.comfd27b31afef8d2089ea798799bfd02dd6a443169</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;This code causes my PLC to crash:&lt;/p&gt;
&lt;p&gt;dp: POINTER TO ARRAY&lt;span&gt;[0..7]&lt;/span&gt; OF BYTE;&lt;br/&gt;
soc: BYTE;&lt;br/&gt;
...&lt;br/&gt;
soc := 60;&lt;br/&gt;
dp^&lt;span&gt;[3]&lt;/span&gt; := soc * 2;&lt;/p&gt;
&lt;p&gt;If I add UINT_TO_BYTE() around the multiplication, it works. It seems like the result of a multiplication - even with small numbers - is an integer, ie with 16 bits or more. Can someone confirm this; is this specified somewhere?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>