7

I've got some bytes in a blob, an immutable buffer for binary data and I am looking for a way to convert what it holds into a floating point data structure, Num, since it is the class that fits all those 3 formats that could be in the $blob

  1. IEEE Float
  2. IEEE Double
  3. IEEE Long Double

What would be the best way of doing that conversion?

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Martin Barth
  • 796
  • 4
  • 13

1 Answers1

10

Import NativeCall, perform a cast to a pointer of desired type and dereference the result:

use NativeCall;
nativecast(Pointer[num32], $blob).deref;
Christoph
  • 164,997
  • 36
  • 182
  • 240