<?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>NRF_LOG_FLOAT doesn&amp;#39;t display negative numbers properly</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19993/nrf_log_float-doesn-t-display-negative-numbers-properly</link><description>Platform: nRF52832 using SDK12.2 and Keil 5.20a 
 I&amp;#39;ve encountered strange corner case when displaying negative floats using NRF_LOG_DEBUG . 
 My test code looks like this: 
 float test_float=-0.99701f;

//use sprintf as reference point
char buff</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 21 Dec 2018 10:34:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19993/nrf_log_float-doesn-t-display-negative-numbers-properly" /><item><title>RE: NRF_LOG_FLOAT doesn't display negative numbers properly</title><link>https://devzone.nordicsemi.com/thread/162817?ContentTypeID=1</link><pubDate>Fri, 21 Dec 2018 10:34:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:631b9fc4-5c30-4d12-9204-cd02ce23a51d</guid><dc:creator>Meera Shah</dc:creator><description>&lt;p&gt;I want to print negative float value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_LOG_FLOAT doesn't display negative numbers properly</title><link>https://devzone.nordicsemi.com/thread/77798?ContentTypeID=1</link><pubDate>Mon, 27 Feb 2017 09:58:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71d5b0b6-d219-44bb-bd4f-e3b3cec51254</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You are totally correct. You can also see this from the macro definitions:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define NRF_LOG_FLOAT_MARKER &amp;quot;%d.%02d&amp;quot;

#define NRF_LOG_FLOAT(val) (int32_t)(val),                                     \
                           (int32_t)(((val &amp;gt; 0) ? (val) - (int32_t)(val)       \
                                                : (int32_t)(val) - (val))*100)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;as the integer 0 does not have a sign.&lt;/p&gt;
&lt;p&gt;I will report this internally.&lt;/p&gt;
&lt;p&gt;Ole&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>