From: lionel@quark.enet.dec.com (Steve Lionel)
Subject: Re: Representation of float on DEC-ALPHA
Date: 1995/10/17 [thread overview]
Message-ID: <460qt1$74s@zk2nws.zko.dec.com> (raw)
In-Reply-To: 45thnl$klu@galadriel.iwb.mw.tu-muenchen.de
In article <45thnl$klu@galadriel.iwb.mw.tu-muenchen.de>,
rossgod@eowyn.iwb.mw.tu-muenchen.de (Ulrich Rossgoderer) writes:
|>I've to read a binary file generated on a SGI or a HP workstation. The
|>binary contains float numbers (single precision)?
|>
|>How do I read (convert) them on a DEC-ALPHA workstation? It can't be
|>only done by byte swapping, because the following program
[snip]
|>
|>produces the following output on a SGI:
|>---------------------------------------
|>
|>Please enter float number: 1.0
|>Byte 0: 63, Byte 1: 128, Byte 2: 0, Byte 4: 0
|>
|>Please enter float number: -1.0
|>Byte 0: 191, Byte 1: 128, Byte 2: 0, Byte 4: 0
|>
|>and on a DEC-ALPHA:
|>-------------------
|>
|>Please enter float number: 1.0
|>Byte 0: 0, Byte 1: 0, Byte 2: -128, Byte 4: 63
|>
|>Please enter float number: -1.0
|>Byte 0: 0, Byte 1: 0, Byte 2: -128, Byte 4: -65
If you look closer, you'd see that the Alpha values really are the "same"
(except for byte ordering) as the SGI - on SGI, you're getting the values
displayed as unsigned byte integers, whereas on Alpha they're signed bytes.
(%d is supposed to be signed decimal, so I think the SGI results are wrong.)
The bit patterns are the same (try using %x instead).
--
Steve Lionel Mail: lionel@quark.enet.dec.com
DEC Fortran Development WWW: http://www.digital.com/info/slionel.html
Digital Equipment Corporation CompuServe: 75263,3001
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698 "Free advice is worth every cent"
For information on DEC Fortran 90, see http://www.digital.com/info/hpc/f90/
next prev parent reply other threads:[~1995-10-17 4:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <45thnl$klu@galadriel.iwb.mw.tu-muenchen.de>
1995-10-16 4:00 ` Representation of float on DEC-ALPHA Dan Pop
1995-10-16 4:00 ` Ron Natalie
1995-10-18 4:00 ` Dan Pop
1995-10-20 4:00 ` Phillip Helbig
1995-10-20 4:00 ` Ron Natalie
1995-10-17 4:00 ` Ulrich Rossgoderer
1995-10-17 4:00 ` Steve Lionel [this message]
1995-10-16 4:00 Ulrich Rossgoderer
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox