Am 09.03.2017 um 10:27 schrieb Max Lindqvist:
Hi,
I am working on a small program for analysing freedive
data from Sunnto DM4.
I’ve got some troubles understanding the SampleBlob and
found this email from the link below.
http://lists.subsurface-divelog.org/pipermail/subsurface/2014-November/015798.html
Could you give some advice on how I can convert bytes 4-7
to a depth in meters?
Hi Max,
this is the "normal" representation of a float on a little
endian machine, just cast to float:
#include <stdio.h>
int main ( int argc, char* argv[]) {
unsigned char c[4] = { 0x48, 0xe1, 0xba, 0x3f };
float *d = ( float*) c;
printf ( "float= %f \n", *d);
return 0;
}
The sample is from the link you provided, the output is:
~/Progs/test> gcc d1.c
~/Progs/test> ./a.out
float= 1.460000
Kind regards,
Axel.
--
Axel Richter
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface