<?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>Kinetis Design Studio中的主题 Unsigned Long to Double - value is truncated?</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411597#M3032</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to read a double-precision floating point number from Flash into RAM.&amp;nbsp; It is correctly stored in flash as:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;0x3e3ce7b697e010&lt;/STRONG&gt;&lt;STRONG&gt;B6&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; = &lt;SPAN style="color: #000000; text-align: -webkit-center; font-size: 12pt; font-family: Calibri;"&gt;6.7299999999999997139836383094E-9&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 12pt; text-align: -webkit-center;"&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since Processor Expert provides methods for reading (at most) Long data types, I am loading 4 bytes at a time using:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; double myDbl;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned long temp0, temp1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFsh1_TAddress Addr = FLASH_LOC;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;//this is where the 8-byte double is correctly stored as &lt;SPAN style="font-size: 13.3333330154419px;"&gt;0x3e3ce7b6 97e010&lt;SPAN style="text-decoration: underline;"&gt;B6&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFsh1_GetLongFlash(Addr, &amp;amp;temp0); &lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //here temp0 is correctly populated with &lt;/STRONG&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;0x3E3CE7B6&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFsh1_GetLongFlash(Addr+4, &amp;amp;temp1);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;//here temp1 is correctly populated with 0x&lt;/STRONG&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;97E010B6&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myDbl = &lt;SPAN style="font-size: 13.3333330154419px;"&gt;((unsigned long long)(temp0)&amp;lt;&amp;lt;32) |&lt;/SPAN&gt; (unsigned long long)(temp1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;//adding/ORing produces the same result&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, no matter how i cast or combine these variables in RAM, &lt;SPAN style="text-decoration: underline;"&gt;the last byte of the fractional part of myDbl is truncated&lt;/SPAN&gt;.&amp;nbsp; I wind up with:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myDbl = 0x3e3ce7b697e010&lt;STRONG style="text-decoration: underline;"&gt;00&lt;/STRONG&gt; = 4.4847141003722793e+018 (according to the debugger)&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can manually edit the fraction in the debugger, but it won't let me change "00" to "B6".&amp;nbsp; It's almost like it thinks that would be out of range for a double, which it's not.&amp;nbsp; I've tried casting temp0, temp1, and their combination as long, ulong, long long, and unsigned long long.&amp;nbsp; I've tried adding, ORing, and anything else i could think of.&amp;nbsp; &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result is the same even if I hard code it as myDbl = (double)(0x3E3CE7B697E010B6);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the FRDM-KL02Z board, and I'm using KDS 2.0.0 with the Cross ARM GNU Assembler and Cross ARM C Compiler and GDB PEMicro (OpenSDA) debugger.&amp;nbsp; Optimizations are set to none and Endianness is Little.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Casting issue?&amp;nbsp; Compiler issue?&amp;nbsp; Can anyone help???&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance,&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Apr 2015 13:06:33 GMT</pubDate>
    <dc:creator>jscott</dc:creator>
    <dc:date>2015-04-15T13:06:33Z</dc:date>
    <item>
      <title>Unsigned Long to Double - value is truncated?</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411597#M3032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to read a double-precision floating point number from Flash into RAM.&amp;nbsp; It is correctly stored in flash as:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;0x3e3ce7b697e010&lt;/STRONG&gt;&lt;STRONG&gt;B6&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; = &lt;SPAN style="color: #000000; text-align: -webkit-center; font-size: 12pt; font-family: Calibri;"&gt;6.7299999999999997139836383094E-9&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 12pt; text-align: -webkit-center;"&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since Processor Expert provides methods for reading (at most) Long data types, I am loading 4 bytes at a time using:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; double myDbl;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned long temp0, temp1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFsh1_TAddress Addr = FLASH_LOC;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;//this is where the 8-byte double is correctly stored as &lt;SPAN style="font-size: 13.3333330154419px;"&gt;0x3e3ce7b6 97e010&lt;SPAN style="text-decoration: underline;"&gt;B6&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFsh1_GetLongFlash(Addr, &amp;amp;temp0); &lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //here temp0 is correctly populated with &lt;/STRONG&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;0x3E3CE7B6&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFsh1_GetLongFlash(Addr+4, &amp;amp;temp1);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;//here temp1 is correctly populated with 0x&lt;/STRONG&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;97E010B6&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myDbl = &lt;SPAN style="font-size: 13.3333330154419px;"&gt;((unsigned long long)(temp0)&amp;lt;&amp;lt;32) |&lt;/SPAN&gt; (unsigned long long)(temp1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;//adding/ORing produces the same result&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, no matter how i cast or combine these variables in RAM, &lt;SPAN style="text-decoration: underline;"&gt;the last byte of the fractional part of myDbl is truncated&lt;/SPAN&gt;.&amp;nbsp; I wind up with:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myDbl = 0x3e3ce7b697e010&lt;STRONG style="text-decoration: underline;"&gt;00&lt;/STRONG&gt; = 4.4847141003722793e+018 (according to the debugger)&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can manually edit the fraction in the debugger, but it won't let me change "00" to "B6".&amp;nbsp; It's almost like it thinks that would be out of range for a double, which it's not.&amp;nbsp; I've tried casting temp0, temp1, and their combination as long, ulong, long long, and unsigned long long.&amp;nbsp; I've tried adding, ORing, and anything else i could think of.&amp;nbsp; &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result is the same even if I hard code it as myDbl = (double)(0x3E3CE7B697E010B6);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the FRDM-KL02Z board, and I'm using KDS 2.0.0 with the Cross ARM GNU Assembler and Cross ARM C Compiler and GDB PEMicro (OpenSDA) debugger.&amp;nbsp; Optimizations are set to none and Endianness is Little.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Casting issue?&amp;nbsp; Compiler issue?&amp;nbsp; Can anyone help???&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance,&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2015 13:06:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411597#M3032</guid>
      <dc:creator>jscott</dc:creator>
      <dc:date>2015-04-15T13:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned Long to Double - value is truncated?</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411598#M3033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you share your project so we can test it on our side?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Carlos Mendoza&lt;/P&gt;&lt;P&gt;Technical Support Engineer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Apr 2015 15:33:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411598#M3033</guid>
      <dc:creator>Carlos_Mendoza</dc:creator>
      <dc:date>2015-04-21T15:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned Long to Double - value is truncated?</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411599#M3034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Carlos,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sure, I can share it with Freescale.&amp;nbsp; Please see the attached.&amp;nbsp; The brute force attempt to convert a value is on line 62 of init.c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Apr 2015 18:58:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411599#M3034</guid>
      <dc:creator>jscott</dc:creator>
      <dc:date>2015-04-21T18:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned Long to Double - value is truncated?</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411600#M3035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Carlos,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you receive my project?  Have you had a chance to try it out?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 11:19:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411600#M3035</guid>
      <dc:creator>jscott</dc:creator>
      <dc:date>2015-04-24T11:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned Long to Double - value is truncated?</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411601#M3036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I received your project and I'm already reviewing it. I will come back to you asap. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Carlos Mendoza&lt;/P&gt;&lt;P&gt;Technical Support Engineer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 22:54:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411601#M3036</guid>
      <dc:creator>Carlos_Mendoza</dc:creator>
      <dc:date>2015-04-24T22:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned Long to Double - value is truncated?</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411602#M3037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apologies for the delay, the behavior you see of the lost of precision in your double variable happens because not all 64 bits of your integer number fit on the significant field (52 bits) of your double precision floating-point variable. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The representations of floating-point variables are encoded in the following three fields:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/50108iDE7F27AC544A4DA7/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_0.png" alt="pastedImage_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The values of k, p, t, w, and bias for binary interchange formats are listed on the following table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/51363iBFA5FD27362FC7CF/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can find more information on the following link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=4610935" title="http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=4610935"&gt;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=4610935&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if this helps or if you have any question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Carlos Mendoza&lt;/P&gt;&lt;P&gt;Technical Support Engineer&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2015 00:01:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411602#M3037</guid>
      <dc:creator>Carlos_Mendoza</dc:creator>
      <dc:date>2015-04-29T00:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned Long to Double - value is truncated?</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411603#M3038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Carlos,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the information, but I’m afraid I still don’t see the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the example I gave with 0x3E 3C E7 B6 97 E0 10 B6, the binary representation is 64 bits long:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;00111110 00111100 11100111 10110110 10010111 11100000 00010000 10110110&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sign is 1 bit long:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The exponent (w) is 11 bits long (995 decimal, below the maximum of 1023): &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;01111100011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the significand (t) is indeed 52 bits long:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1100111001111011011010010111111000000001000010110110&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I can tell, this is a completely valid double precision value according to the references you provided.  An online converter here confirms:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.binaryconvert.com/result_double.html?hexadecimal=3E3CE7B697E010B6" target="test_blank"&gt;http://www.binaryconvert.com/result_double.html?hexadecimal=3E3CE7B697E010B6&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interestingly enough, if you plug the truncated value 0x3e3ce7b697e01000 into this converter, it generates a number very close to the 6.72999…E-9 shown above.  But the KDS debugger (GDB PEMicro Interface) shows 4.4847141003722793e+018.  You should be able to replicate this very easily with the project I provided.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If, as it appears, the fields are indeed the correct length and within range, why does the debugger show such a different value?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2015 13:23:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411603#M3038</guid>
      <dc:creator>jscott</dc:creator>
      <dc:date>2015-04-29T13:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned Long to Double - value is truncated?</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411604#M3039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found the problem, and it had more to do with endianness than anything else.&amp;nbsp; If I store the double in flash as [b4..b7][b0..b3], then just do an 8-byte memcopy to RAM, everything works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2015 20:04:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Unsigned-Long-to-Double-value-is-truncated/m-p/411604#M3039</guid>
      <dc:creator>jscott</dc:creator>
      <dc:date>2015-05-01T20:04:57Z</dc:date>
    </item>
  </channel>
</rss>

