comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Convert 8 byte array to double
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Convert 8 byte array to double [message #94015] Wed, 21 December 2016 02:25 Go to previous message
LNpellen is currently offline  LNpellen
Messages: 37
Registered: November 2009
Member
I'm working with DICOM files where a floating number is saved as BYTE array[8] and I know (at least pretty sure) it is a double precision floating number, but I cannot figure out how to convert it to DOUBLE.

IDL> help, a
A BYTE = Array[8]
IDL> print, a
51 51 51 51 51 51 227 63
IDL> print, string(a)
333333ã?
IDL> print, string(a, format='(Z)')
33 33 33 33 33 33 E3 3F
IDL> print, double(a)
51.000000 51.000000 51.000000 51.000000 51.000000 51.000000 227.00000 63.000000

I understand that I can calculate it myself, but that will require a whole lot of code and quite some reading to understand howto. Anybody know of an easier way? As DOUBLE really is a 64bit number...

I have also a feeling that this is swapped endian, or what it is called. (3F first, 33 last).
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: date/time generation
Next Topic: FYI: What's New in IDL 8.6

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:32:55 PDT 2025

Total time taken to generate the page: 0.00380 seconds