<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Weird things happening with floats in nRF51, GCC, Eclipse</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11739/weird-things-happening-with-floats-in-nrf51-gcc-eclipse</link><description>Hello, I wanted to show here two cases that made me crazy today and I fixed using workarounds, but still have no idea why they are happening. 
 In main context I call a function that returns a float, I print this float with RTT and it is always fine</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 15 Feb 2016 11:18:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11739/weird-things-happening-with-floats-in-nrf51-gcc-eclipse" /><item><title>RE: Weird things happening with floats in nRF51, GCC, Eclipse</title><link>https://devzone.nordicsemi.com/thread/44403?ContentTypeID=1</link><pubDate>Mon, 15 Feb 2016 11:18:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b39841bb-1575-48de-aa5b-4b4475f9c839</guid><dc:creator>Luis</dc:creator><description>&lt;p&gt;Thanks for the attention Vidar.
I discovered that these errors I am seeing could be related to timing as well, because I have seen they disappear when addding / removing unrelated things in those functions...  So now I have moved along but I will come back to this later in order to sort it out using GDB as you mentioned. I will update once I test it again. Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Weird things happening with floats in nRF51, GCC, Eclipse</title><link>https://devzone.nordicsemi.com/thread/44402?ContentTypeID=1</link><pubDate>Wed, 10 Feb 2016 09:53:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abd79048-4d2a-4335-9217-e4db44bc57d1</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Unfortunately, was unable to reproduce the issue you describe here. I used the same linker and compiler flags. If you are familiar with GDB I&amp;#39;d suggest to check whether it is the cast that is  failing or that the float value is invalid. For instance in case A you can try to break when sprintf returns NaN and read the value of &amp;#39;b&amp;#39;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>