<div dir="ltr">I don't know what you mean by "<span class="" style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px">the binary I receive is of the form {int, int}", but decoding binaries directly is done using the bitstring syntax:</span><div>
<div><div><font class="" face="arial, sans-serif"><span class="" style="border-collapse:collapse"><br></span></font></div></div><div><div>5> Data = <<123,0,0,0,205,204,204,62>>.</div><div>6> <<A:32/little, B:32/float-little>> = Data. % In case the numbers are encoded in little-endian.</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div>7> A.<br></div><div>123</div><div>8> B.</div><div>0.4000000059604645</div></div></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
2013/7/18 Schneider <span dir="ltr"><<a href="mailto:js@globe.de" target="_blank">js@globe.de</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">yea, this should work. But It's looks like my Problem is a little bit more complicated:<br>
<br>
I have a C client sending some Data via UDP. And I want to write a Erlang program receiving this data.<br>
<br>
the Data is of the form {unsigned long, float} (both stored as 4Byte values) but the binary I receive is of the form {int, int}.<br>
How can i convert the second one to an erlang float?<br>
<br>
bg,<br>
Johannes<div class="im"><br>
<br>
On Wed 17 Jul 2013 04:30:45 PM CEST, Wes James wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Alternative for now??<br>
<br>
list_to_float(binary:bin_to_<u></u>list(<<"10.0">>)).<br>
10.0<br>
<br>
<br>
On Wed, Jul 17, 2013 at 8:02 AM, Schneider <<a href="mailto:js@globe.de" target="_blank">js@globe.de</a><br></div><div class="im">
<mailto:<a href="mailto:js@globe.de" target="_blank">js@globe.de</a>>> wrote:<br>
<br>
Hi List,<br>
<br>
I cannot find the function binary_to_float/1.<br>
<br>
using Erlang R14B04 (erts-5.8.5) on ubuntu precise.<br>
What do I miss?<br>
<br>
bg,<br>
Johannes<br>
<br>
--<br>
GLOBE Development GmbH<br>
Königsberger Strasse 260<br>
48157 MünsterGLOBE Development GmbH<br>
Königsberger Strasse 260<br>
48157 Münster<br>
0251/5205 390<br>
<br></div>
______________________________<u></u>___________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a> <mailto:<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@<u></u>erlang.org</a>><br>
<a href="http://erlang.org/mailman/__listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/__<u></u>listinfo/erlang-questions</a><br>
<<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a>><br>
<br>
<br>
</blockquote><div class="HOEnZb"><div class="h5">
<br>
<br>
<br>
--<br>
GLOBE Development GmbH<br>
Königsberger Strasse 260<br>
48157 MünsterGLOBE Development GmbH<br>
Königsberger Strasse 260<br>
48157 Münster<br>
0251/5205 390<br>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>