<?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 Math.Sin Function Not Working for some values of the input argument in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Math-Sin-Function-Not-Working-for-some-values-of-the-input/m-p/184836#M4428</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using CodeWarrior v 5.9.0 and DSP board MC56F8037&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to calculate Sin(arg) and Cos(arg) (to get parameters for FFT analysis)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;for (k = 1; k &amp;lt; transformLength; k++)&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;arg = 2*(float)bin*M_PI*(float)k / (float)transformLength;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sinPart = sinPart+(inputData[k] * sign * sin(arg);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cosPart = cosPart + (inputData[k] * cos(arg));&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The problem is sin(arg) works fine for many values of arg, but for some values of arg it gives TOTALY different output values and destroys all the calculations furhter on.&lt;/DIV&gt;&lt;DIV&gt;Example&lt;/DIV&gt;&lt;DIV&gt;In CodeWarrior when i debug(having imported Math.h) i get&lt;/DIV&gt;&lt;DIV&gt;sin(11.584)=0.968&lt;/DIV&gt;&lt;DIV&gt;When i calculate on the calculator (as well as try to calculate in c sharp coded program) It gives&lt;/DIV&gt;&lt;DIV&gt;sin(11.584) = -0.828&lt;/DIV&gt;&lt;DIV&gt;This is such a huge difference...and it happens for random samples.&lt;/DIV&gt;&lt;DIV&gt;For other samples like sin(5.694)=-0.555 both in COdeWarrior and C Shapr the values are the SAME.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;THIS has been really really driving me crazy.&lt;/DIV&gt;&lt;DIV&gt;Please, Could you look at this ... Is this a bug???&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Feb 2011 05:51:37 GMT</pubDate>
    <dc:creator>studentLwatch</dc:creator>
    <dc:date>2011-02-21T05:51:37Z</dc:date>
    <item>
      <title>Math.Sin Function Not Working for some values of the input argument</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Math-Sin-Function-Not-Working-for-some-values-of-the-input/m-p/184836#M4428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using CodeWarrior v 5.9.0 and DSP board MC56F8037&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to calculate Sin(arg) and Cos(arg) (to get parameters for FFT analysis)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;for (k = 1; k &amp;lt; transformLength; k++)&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;arg = 2*(float)bin*M_PI*(float)k / (float)transformLength;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sinPart = sinPart+(inputData[k] * sign * sin(arg);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cosPart = cosPart + (inputData[k] * cos(arg));&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The problem is sin(arg) works fine for many values of arg, but for some values of arg it gives TOTALY different output values and destroys all the calculations furhter on.&lt;/DIV&gt;&lt;DIV&gt;Example&lt;/DIV&gt;&lt;DIV&gt;In CodeWarrior when i debug(having imported Math.h) i get&lt;/DIV&gt;&lt;DIV&gt;sin(11.584)=0.968&lt;/DIV&gt;&lt;DIV&gt;When i calculate on the calculator (as well as try to calculate in c sharp coded program) It gives&lt;/DIV&gt;&lt;DIV&gt;sin(11.584) = -0.828&lt;/DIV&gt;&lt;DIV&gt;This is such a huge difference...and it happens for random samples.&lt;/DIV&gt;&lt;DIV&gt;For other samples like sin(5.694)=-0.555 both in COdeWarrior and C Shapr the values are the SAME.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;THIS has been really really driving me crazy.&lt;/DIV&gt;&lt;DIV&gt;Please, Could you look at this ... Is this a bug???&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Feb 2011 05:51:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Math-Sin-Function-Not-Working-for-some-values-of-the-input/m-p/184836#M4428</guid>
      <dc:creator>studentLwatch</dc:creator>
      <dc:date>2011-02-21T05:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Math.Sin Function Not Working for some values of the input argument</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Math-Sin-Function-Not-Working-for-some-values-of-the-input/m-p/184837#M4429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would recommend you to submit a service request to get support people looking at that.&lt;BR /&gt;&lt;BR /&gt;Click here to submit a service request.&lt;BR /&gt;&lt;BR /&gt;Make sure to attach a reproducible project and installed product information to the service request.&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Feb 2011 15:57:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Math-Sin-Function-Not-Working-for-some-values-of-the-input/m-p/184837#M4429</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2011-02-21T15:57:31Z</dc:date>
    </item>
  </channel>
</rss>

