<?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>CodeWarrior for MCUのトピックRe: Float use in CW 10.2</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Float-use-in-CW-10-2/m-p/253040#M9731</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;The Freescale in its MCU model description describes the MCU that has&lt;SPAN style="color: #222222; font-family: arial, sans-serif; background-color: #ffffff;"&gt; FPU (&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.513513565063477px;"&gt;Floating Point Unit)&lt;/SPAN&gt; or MCU that work as DSP. For example: MK60FN..... - this MCU has FPU, MK60DN... - this MCU hasn't FPU. &lt;/P&gt;&lt;P&gt;I have demo board MK60DN... therefore I can't use the float as uint8, uint16 or uint32 variables in compare operations. But if I want to use float values I can multiply them with 10 for get the int and perform compare operations. Otherwise no one compare operation will not performe.&lt;/P&gt;&lt;P&gt;Have a good day.&lt;/P&gt;&lt;P&gt;Evgeni.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 14 Apr 2013 19:26:32 GMT</pubDate>
    <dc:creator>evgenik</dc:creator>
    <dc:date>2013-04-14T19:26:32Z</dc:date>
    <item>
      <title>Float use in CW 10.2</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Float-use-in-CW-10-2/m-p/253037#M9728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I work with K60/K61 MCUs. At this time I added to project float type variables for calculation. But don't all operations are work perfect.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;1)&lt;/P&gt;&lt;P&gt;float Signal = GetValue();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Signal = 0.6&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(Signal &amp;gt;= 0.5) // this compare not occured never&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Signal += 0.1;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;P&gt;float Signal = GetValue();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Signal = 0.6&lt;/P&gt;&lt;P&gt;float Compare = 0.5;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(Signal &amp;gt;= Compare) // this compare not occured never&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Signal += 0.1;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;In Project Properties-&amp;gt;C/C++ Build/Settings// ARM CPU-&amp;gt;Floating point selected "Software (default)".&lt;/P&gt;&lt;P&gt;What is a problem with float operations in CW 10.2 with Kinetis?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Evgeni.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2013 06:29:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Float-use-in-CW-10-2/m-p/253037#M9728</guid>
      <dc:creator>evgenik</dc:creator>
      <dc:date>2013-04-05T06:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Float use in CW 10.2</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Float-use-in-CW-10-2/m-p/253038#M9729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Do you mean that the code inside the if is not executed, or that the debugger did not step to that line?&lt;/P&gt;&lt;P&gt;I ask because I have seen cases with compiler optimizations that the debugger did not stepped into the if, but the code was executed well.&lt;/P&gt;&lt;P&gt;So might try stepping with assembly stepping mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other thing to check: are you using prototypes?&lt;/P&gt;&lt;P&gt;Is it like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;float GetValue(void);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;float Signal = GetValue();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Signal = 0.6&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(Signal &amp;gt;= 0.5) // this compare not occured never&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Signal += 0.1;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, if you have something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;float GetValue(void);&lt;/P&gt;&lt;P&gt;void foo(void) {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;float Signal = GetValue();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Signal = 0.6&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(Signal &amp;gt;= 0.5) // this compare not occured never&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Signal += 0.1;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;Then the compiler simply could remove the code (as not used/no side effect).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;So it would be good if you could post an actual function or more details what you do?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;I quickly tried your snippets with CodeWarrior MCU10.3 and gcc, and it works properly for me.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: as 0.6 is of type double, it would be good if you would change things to use the 'f' suffix to mark things of type float. E.g.&lt;/P&gt;&lt;P&gt;if (Signal&amp;gt;=0.5f)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2013 07:30:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Float-use-in-CW-10-2/m-p/253038#M9729</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2013-04-05T07:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Float use in CW 10.2</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Float-use-in-CW-10-2/m-p/253039#M9730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Evgeni!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How is the project going going, any breakthroughs? Keep us posted! :smileywink:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Monica.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2013 18:36:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Float-use-in-CW-10-2/m-p/253039#M9730</guid>
      <dc:creator>Monica</dc:creator>
      <dc:date>2013-04-11T18:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Float use in CW 10.2</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Float-use-in-CW-10-2/m-p/253040#M9731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;The Freescale in its MCU model description describes the MCU that has&lt;SPAN style="color: #222222; font-family: arial, sans-serif; background-color: #ffffff;"&gt; FPU (&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.513513565063477px;"&gt;Floating Point Unit)&lt;/SPAN&gt; or MCU that work as DSP. For example: MK60FN..... - this MCU has FPU, MK60DN... - this MCU hasn't FPU. &lt;/P&gt;&lt;P&gt;I have demo board MK60DN... therefore I can't use the float as uint8, uint16 or uint32 variables in compare operations. But if I want to use float values I can multiply them with 10 for get the int and perform compare operations. Otherwise no one compare operation will not performe.&lt;/P&gt;&lt;P&gt;Have a good day.&lt;/P&gt;&lt;P&gt;Evgeni.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Apr 2013 19:26:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Float-use-in-CW-10-2/m-p/253040#M9731</guid>
      <dc:creator>evgenik</dc:creator>
      <dc:date>2013-04-14T19:26:32Z</dc:date>
    </item>
  </channel>
</rss>

