<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Fixed Point Problems in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Fixed-Point-Problems/m-p/592618#M30083</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Leji on Tue Apr 03 08:57:40 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;it does work as expected for me, I get 0x1C as integer and 0x4D9 as fractional part, which is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2^-2+2^-5+2^-6+2^-8+2^-9+2^-11 ~= 0.303&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;which is what my TI calculator says.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;what's the issue exactly ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 22:55:40 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T22:55:40Z</dc:date>
    <item>
      <title>Fixed Point Problems</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Fixed-Point-Problems/m-p/592617#M30082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Caradhras on Tue Apr 03 01:44:43 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i got a simple question, regarding a fixed point division on a LPC11C24. I think the problem should be device independant and sitting before my keyboard.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I got this simple example code, i found on another arm-forum:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
typedef int32_t fx_t;

#define FX_FRAC 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // define position of decimal point
// explanation: FX_FRAC = 12 ==&amp;gt; 20 Bit for Integer-Value, 12 for fractional value

#define fx_float(a) (a / (float)(1LL&amp;lt;&amp;lt;FX_FRAC))
#define fx_make(a)&amp;nbsp; ((fx_t)(a * (1LL&amp;lt;&amp;lt;FX_FRAC)))
#define fx_add(a,b) (a + b)
#define fx_sub(a,b) (a - b)
#define fx_mul(a,b) ((fx_t)(((int64_t)a * b) &amp;gt;&amp;gt; FX_FRAC))
#define fx_div(a,b) ((fx_t)(((int64_t)a &amp;lt;&amp;lt; FX_FRAC) / b))

uint32_t zahl = 934;
zahl = fx_make(zahl);
uint32_t teiler = 33;
teiler = fx_make(teiler);
uint32_t ergebnis = 0;
ergebnis = fx_div(zahl, teiler);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;The integer-part of the result is fine, it is indeed 28. But the fractional part does not have anything in common, what my TI-pocket-calculator says... :confused:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Im pretty new to fixed point math, so is an overflow or something? I got 20 Bits for Integer and 12 Bits for fractional part as precision is not so important.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks and regards!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:55:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Fixed-Point-Problems/m-p/592617#M30082</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Fixed Point Problems</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Fixed-Point-Problems/m-p/592618#M30083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Leji on Tue Apr 03 08:57:40 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;it does work as expected for me, I get 0x1C as integer and 0x4D9 as fractional part, which is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2^-2+2^-5+2^-6+2^-8+2^-9+2^-11 ~= 0.303&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;which is what my TI calculator says.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;what's the issue exactly ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:55:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Fixed-Point-Problems/m-p/592618#M30083</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Fixed Point Problems</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Fixed-Point-Problems/m-p/592619#M30084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Caradhras on Mon Apr 09 15:44:09 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sorry for not reporting back.&amp;nbsp; Thanks for the help, it was just that easy. :rolleyes:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:55:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Fixed-Point-Problems/m-p/592619#M30084</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:55:41Z</dc:date>
    </item>
  </channel>
</rss>

