<?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: sqrtf() mathematical function not yielding correct answer!!! in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/sqrtf-mathematical-function-not-yielding-correct-answer/m-p/171348#M3440</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 did a quick test with v10.1 and Coldfire v1 project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sizeof(float)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; returns 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sizeof(double) returns 8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So according to my understanding float variables are stored on 4 bytes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that if you enable c99 language you should be able to use fiction sqrtf, which is an implementation of sqrt with float parameter and return value &amp;nbsp;instead of double.&lt;/P&gt;&lt;P&gt;If you activate c99 language you need to link the appropriate library to your project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For library naming convention check MCU_ColdFire_Compiler.pdf, chapter ColdFire runtime Libraries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Oct 2011 15:59:25 GMT</pubDate>
    <dc:creator>CrasyCat</dc:creator>
    <dc:date>2011-10-04T15:59:25Z</dc:date>
    <item>
      <title>sqrtf() mathematical function not yielding correct answer!!!</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/sqrtf-mathematical-function-not-yielding-correct-answer/m-p/171345#M3437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Im using CW 6.3 for programming Coldfire V1 MCF51EM256.&lt;/P&gt;&lt;P&gt;The problem that im facing is that the sqrtf() function for square root is giving incorrect answer.&amp;nbsp;I've included the required header file "math.h". When compiling it does'nt give me any errors or warnings as well; just the value returned by the function is wrong!!!&lt;/P&gt;&lt;P&gt;Please advice if there is anything else i need to do to use mathematical functions other than including "math.h".&lt;/P&gt;&lt;P&gt;Thanks in advance!!! &lt;SPAN aria-label="Happy" class="emoticon_happy emoticon-inline" style="height:16px;width:16px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Oct 2011 12:23:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/sqrtf-mathematical-function-not-yielding-correct-answer/m-p/171345#M3437</guid>
      <dc:creator>bingo23</dc:creator>
      <dc:date>2011-10-03T12:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: sqrtf() mathematical function not yielding correct answer!!!</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/sqrtf-mathematical-function-not-yielding-correct-answer/m-p/171346#M3438</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;You need to link the appropriate MSL library to your project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please create a new project using the wizard in codeWarrior and specify you are going to use floating point arithmetic.&lt;/P&gt;&lt;P&gt;The project should be correctly set up to enable usage of math functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Oct 2011 13:00:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/sqrtf-mathematical-function-not-yielding-correct-answer/m-p/171346#M3438</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2011-10-03T13:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: sqrtf() mathematical function not yielding correct answer!!!</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/sqrtf-mathematical-function-not-yielding-correct-answer/m-p/171347#M3439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply. However&amp;nbsp; I have a doubt.&lt;/P&gt;&lt;P&gt;When creating a new project the only option i get regarding enabling floating point arithmetic is "Select if you want floating point support" with&amp;nbsp;two selection settings: 1.None &amp;nbsp;2. float is IEEE64,double is IEEE64 .&lt;/P&gt;&lt;P&gt;My doubt is if i select the 2nd setting, won't my float also become 64 bits i.e. 8 bytes?? If this is the case then I wont be able to use it because of a space constraint!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Oct 2011 13:30:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/sqrtf-mathematical-function-not-yielding-correct-answer/m-p/171347#M3439</guid>
      <dc:creator>bingo23</dc:creator>
      <dc:date>2011-10-03T13:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: sqrtf() mathematical function not yielding correct answer!!!</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/sqrtf-mathematical-function-not-yielding-correct-answer/m-p/171348#M3440</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 did a quick test with v10.1 and Coldfire v1 project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sizeof(float)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; returns 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sizeof(double) returns 8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So according to my understanding float variables are stored on 4 bytes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that if you enable c99 language you should be able to use fiction sqrtf, which is an implementation of sqrt with float parameter and return value &amp;nbsp;instead of double.&lt;/P&gt;&lt;P&gt;If you activate c99 language you need to link the appropriate library to your project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For library naming convention check MCU_ColdFire_Compiler.pdf, chapter ColdFire runtime Libraries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Oct 2011 15:59:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/sqrtf-mathematical-function-not-yielding-correct-answer/m-p/171348#M3440</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2011-10-04T15:59:25Z</dc:date>
    </item>
  </channel>
</rss>

