Decoding single precision bytes

Linus Torvalds torvalds at linux-foundation.org
Fri Nov 7 09:24:44 PST 2014


On Nov 7, 2014 8:23 AM, "John Van Ostrand" <john at vanostrand.com> wrote:
>
> Are floats portable enough to reference directly, like this:
>
> start_cns = *(float *) buf;

Aside from byte ordering and alignment, generally yes. There are some
random small details like denormals that different architecture might
handle differently (round to zero etc), but that won't be an issue for any
dive data.

And in theory other representations than just the standard IEEE one exists,
but in practice no current hardware uses it, so it's not worth worrying
about.

    Linus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20141107/f02fc6fe/attachment.html>


More information about the subsurface mailing list