<?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>How to print floats with NRF_LOG macros</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24030/how-to-print-floats-with-nrf_log-macros</link><description>Trying to print floats with NRF_LOG functions always prints a value of 0.00000. 
 E.g. 
 float value = 123.456; NRF_LOG_ERROR( &amp;quot;Float %f\r\n&amp;quot;, value ); 
 prints: 
 ERROR:Float 0.00000 
 but
 NRF_LOG_ERROR( &amp;quot;Float %u\r\n&amp;quot;, (uint16_t)value ); 
 prints</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 Jul 2019 13:56:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24030/how-to-print-floats-with-nrf_log-macros" /><item><title>RE: How to print floats with NRF_LOG macros</title><link>https://devzone.nordicsemi.com/thread/200789?ContentTypeID=1</link><pubDate>Fri, 26 Jul 2019 13:56:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef0966c8-b6d2-4a0c-aeee-ffb82c9c1088</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Note that you are replying to a &lt;strong&gt;two year old&lt;/strong&gt; thread - presumably, it has been fixed in the meantime?&lt;/p&gt;
&lt;p&gt;Which SDK version(s) are you referring to?&lt;/p&gt;
&lt;p&gt;A similar bug exists (existed?) in the Thingy code:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/47223/error-in-thingy-52-environment-service---temperature"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/47223/error-in-thingy-52-environment-service---temperature&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to print floats with NRF_LOG macros</title><link>https://devzone.nordicsemi.com/thread/200760?ContentTypeID=1</link><pubDate>Fri, 26 Jul 2019 12:11:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94c8760d-dc11-40fc-a7cb-289ee2f3419d</guid><dc:creator>GT</dc:creator><description>&lt;p&gt;The macros shows correct values even between&amp;nbsp;&lt;code&gt;-1.0&amp;lt;value&amp;lt;0.0&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to print floats with NRF_LOG macros</title><link>https://devzone.nordicsemi.com/thread/94589?ContentTypeID=1</link><pubDate>Wed, 02 Aug 2017 21:08:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ee215ac-432f-4cbc-8913-a2b47a028e83</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;There are special macros available for float values:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_LOG_ERROR( &amp;quot;Float &amp;quot; NRF_LOG_FLOAT_MARKER &amp;quot;\r\n&amp;quot;, NRF_LOG_FLOAT(value));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note: These macros wrongly show values &lt;code&gt;-1.0&amp;lt;value&amp;lt;0.0&lt;/code&gt; as positive.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Printing a char* string variable with &amp;quot;%s&amp;quot; also fails to compile.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Try using &lt;code&gt;nrf_log_push()&lt;/code&gt;. The &lt;code&gt;-Werror&lt;/code&gt; gcc option may be incompatible with NRF_LOG_ functions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>