<?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>32-bit float transmission</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21479/32-bit-float-transmission</link><description>I have 32-bit float numbers, sent to the BLE from SPI.
I can manipulate this into x4 bytes, or actually use sprintf and get a real 6-byte representation of the number. 
 For debugging:
So, to make debugging possible / easy, (I do not have a client</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Apr 2017 06:05:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21479/32-bit-float-transmission" /><item><title>RE: 32-bit float transmission</title><link>https://devzone.nordicsemi.com/thread/84267?ContentTypeID=1</link><pubDate>Thu, 20 Apr 2017 06:05:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa4e4871-ced0-43cc-803c-512152e5cff0</guid><dc:creator>Vyacheslav Lebets</dc:creator><description>&lt;p&gt;Hi.
You can use &amp;quot;union&amp;quot; like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;union Data
{
       float ff;
       int32_t ii;
       uint32_t uii;
       uint8_t cc[4];
};

//in one place
...
Data your_data;
your_data.ff = -1.999;
int32_t i_value = your_data.ii;
uint32_t ui_value = your_data.uii;
...


//in second place
...
Data your_data;
your_data.ii = -1073750213; //this is a &amp;quot;-1.999&amp;quot; in signed integer representation
//or
//your_data.uii = 3221217083; //this is a &amp;quot;-1.999&amp;quot; in unsigned integer representation
float f_value = your_data.ff;
...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Best, VL.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>