Re: How to byte swap an IEEE Float?
- From: "Björn" <ssh9614@xxxxxxxxxxx>
- Date: 28 Jun 2005 13:43:24 -0700
> Sure. You know, I meant representation = bits and bytes, implying same
> length. It seems the OP already has the float type (IEEE_Float_32),
> 32-bit = 4-byte long, and the data are floats of this length, only
> different in byte order.
>
> OP, if the data are of a different length, then you have to unchecked
> convert first to a float type of that length, and then normal convert
> to the final type (risking Constraint_Error).
All the data in the file are of 32 bits float so that should be ok.
The target for the values is at the moment x86 (although I do expect it
to work on PowerPC as well so I check System.Default_Bit_Order before
doing any byte swapping). My dirty workaround for the moment was to
read the data as a string. I was merly wondering which is the
normal/"best" way to deal with this, since I expect it to be a
fairly common task. A packed byte array does however seem like a much
better idea than handling it as a string.
Regards
Björn
.
- Follow-Ups:
- Re: How to byte swap an IEEE Float?
- From: Randy Brukardt
- Re: How to byte swap an IEEE Float?
- From: Marius Amado Alves
- Re: How to byte swap an IEEE Float?
- References:
- How to byte swap an IEEE Float?
- From: Björn
- Re: How to byte swap an IEEE Float?
- From: Marius Amado Alves
- Re: How to byte swap an IEEE Float?
- From: Simon Wright
- Re: How to byte swap an IEEE Float?
- From: Marius Amado Alves
- How to byte swap an IEEE Float?
- Prev by Date: Re: Dynamic Plug-in Loading with Ada
- Next by Date: Re: Dynamic Plug-in Loading with Ada
- Previous by thread: Re: How to byte swap an IEEE Float?
- Next by thread: Re: How to byte swap an IEEE Float?
- Index(es):
Relevant Pages
|