how to convert double to byte[] openvms format?

T

troy

Hi, I am trying to figure out how to convert a double in java to an
array of 8 bytes that is compatible with openvms alpha programs. It's
more complicated than a big endian/little endian issue. Any ideas?

A double on openvms of '3495.0' has the following 8 bytes:
90 70 0 112 0 0 0 0 (openVMS Basic program was used to get the bytes)

A GFloat on openvms of '3495.0' has the following 8 bytes:
-53 64 0 78 0 0 0 0 (openVMS Basic program was used to get the bytes)

A double in java of '3495' has the following 8 bytes:
64 -85 78 0 0 0 0 0

Note that I can convert the double in java to a gfloat by doing a big
endian/little endian swap and adding 32 to the second byte.
 
R

Roedy Green

Hi, I am trying to figure out how to convert a double in java to an
array of 8 bytes that is compatible with openvms alpha programs. It's
more complicated than a big endian/little endian issue. Any ideas?

A double on openvms of '3495.0' has the following 8 bytes:
90 70 0 112 0 0 0 0 (openVMS Basic program was used to get the bytes)

A GFloat on openvms of '3495.0' has the following 8 bytes:
-53 64 0 78 0 0 0 0 (openVMS Basic program was used to get the bytes)

A double in java of '3495' has the following 8 bytes:
64 -85 78 0 0 0 0 0

Note that I can convert the double in java to a gfloat by doing a big
endian/little endian swap and adding 32 to the second byte.

This will be much easier if you find documentation on the openvms
floating point format. Once you get it in it is a matter of
extracting bits, changing offsets and packing them together again.

If that is impossible to find, try looking at the formats for numbers
like
0 1 .5 .75 etc until you gradually piece together what the bits are
for.
 
J

Jim Korman

On 30 Dec 2005 16:34:44 -0800, (e-mail address removed) wrote, quoted or
indirectly quoted someone who said :
This will be much easier if you find documentation on the openvms
floating point format. Once you get it in it is a matter of
extracting bits, changing offsets and packing them together again.

If that is impossible to find, try looking at the formats for numbers
like
0 1 .5 .75 etc until you gradually piece together what the bits are
for.

Goggling ["OpenVMS double binary format"] gets

http://h71000.www7.hp.com/commercial/basic/basic_doc/bas_um_028.htm

Appears to be what you're looking for.

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top