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

Home » Public Forums » archive » 8 byte 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
Re: 8 byte to double? [message #92601 is a reply to message #92600] Wed, 20 January 2016 05:34 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
fawltylanguage@gmail.com writes:

>
> On Wednesday, January 20, 2016 at 1:39:07 PM UTC+1, LNpellen wrote:
>> I'm lost - and I thought I had solved this previously, but I simply can't find it (maybe it was in php or something...).
>>
>> Some values in the DICOM header for some vendors happens to save floating (double-presition?) values as 8-bytearrays
>>
>> Is there a simple way in IDL to convert this bytearray to a double without coding the type conversion yourself?
>>
>> I couldn't manage to use the DOUBLE function for this.
>>
>> Ex.:
>> I have the byte array [205 204 204 204 204 204 49 64] and it think from my annoyingly short notes that it should be 17.8...?
>>
>> Best regards,
>> Ellen
>
> IDL> b=[205b,204b,204b,204b,204b,204b,49b,64b]
> IDL> print, fix(b, 0, 1, type=5)
> 17.800000

Lajos is right, but here is a little fuller explanation:


http://www.idlcoyote.com/code_tips/packfloat.php

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: MODIS Conversion ToolKit is not working? Can anyone help me?
Next Topic: HDF_SD_START: Invalid HDF file or filename: problem related to network issues

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

Current Time: Wed Oct 08 13:55:59 PDT 2025

Total time taken to generate the page: 0.00411 seconds