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

Home » Public Forums » archive » Re: Differences between IDL's floats and Java's floats - a problem
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: Differences between IDL's floats and Java's floats - a problem [message #36943] Fri, 14 November 2003 01:41 Go to previous message
Nigel Wade is currently offline  Nigel Wade
Messages: 286
Registered: March 1998
Senior Member
R.G. Stockwell wrote:
> "Neil Crosby" <necr@pml.ac.uk> wrote in message
> news:3eda43e9.0311130409.5ee02334@posting.google.com...
>
>> I am currently porting some IDL code across to java, and I've run into
>> a couple of snags with the different ways IDL and Java deal with
>> numbers. Most of these I have sorted, with trips to the APIs and a
>> fair bit of googling. However, there is one I haven't managed to sort
>> out yet.
>
> ...
>
>> If I run the float code on these same four bytes though, IDL will give
>> me 412.50 (the value I want), while Java will give 5.951465E-39 -
>> clearly not the number I'm looking for!
>
> ...
>
>> Neil
>
>
>
> Hi Neil,
> as David said, this looks like a endian problem. Check out
> http://www.ibiblio.org/javafaq/books/javaio/ioexamples/07/in dex.html
>
> and there are some classes that deal with little endian inputs.
>
>
> Cheers,
> bob
>
>

It is. Java DataStreams read in network byte order (big endian).
To read little endian data I read it into a byte[] array and then wrap it in
a ByteBuffer set to ByteOrder.LITTLE_ENDIAN. There's probably a thousand
other ways to to it, I just find that the most straight forward.

--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: how to add a menu item for printing a variable when debugging
Next Topic: IDL crashes

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

Current Time: Sat Oct 11 06:32:43 PDT 2025

Total time taken to generate the page: 0.00261 seconds