Re: How to byte swap an IEEE Float?
- From: Stephen Leake <stephen_leake@xxxxxxx>
- Date: Tue, 28 Jun 2005 19:35:56 -0400
"Björn" <ssh9614@xxxxxxxxxxx> writes:
> I need to read some float values from file that have been written in
> big-endian byte order from a c-program.
See SAL.Network_Order.Gen_Scalar_64 at
http://www.toadmail.com/~ada_wizard/ada/sal.html for a convenient way
to do this.
> The simple swapping procedure that I have just interchanges the byte
> order of type IEEE_Float_32 to get little-endian.
Ok.
> The problem is that for some values (eg. 33.229000) it is a "NaN"
> when doing IEEE_Float_32'Read and I get a constraint error (invalid
> data) from stream_io when the value is read. How do I get around
> this?
Hmm. Are you saying the original value is _not_ a NaN? If so, then
your swap implementation is faulty; try mine.
--
-- Stephe
.
- Follow-Ups:
- Re: How to byte swap an IEEE Float?
- From: Björn
- Re: How to byte swap an IEEE Float?
- References:
- How to byte swap an IEEE Float?
- From: Björn
- How to byte swap an IEEE Float?
- Prev by Date: Re: gnat and fedora these days ?
- Next by Date: Re: How to byte swap an IEEE Float?
- 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
|