Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: griffin@voyageronline.net (Jim Griffin)
Subject: Re: DEC Unix 4.0 IEEE floating point on Alpha
Date: 1997/07/24	[thread overview]
Message-ID: <griffin-2407971002590001@ts-2-61.chatt.voyageronline.net> (raw)
In-Reply-To: 5r5qt6$gd8@crcnis3.unl.edu


In article <5r5qt6$gd8@crcnis3.unl.edu>, james@engrs.unl.edu (James Nau) wrote:

> Hi all,
> 
> I've come across a problem with the floating point format on
> DEC alphas.  It happens under both VMS and Digital Unix.  It
> appears to me that Alphas store IEEE floating point numbers
> backwards.  On an Alpha, for value 511.0, I get:
> 
> 00 80 FF 43
> 
> as the binary representation [written by 
> fwrite( &x, sizeof(float), 1, outfile);]
> 
> while on every other Unix workstation I've been able to get my fingers
> on yields:
> 
> 43 FF 80 00
> 
> which all the tools and info I find say this is 511.0 in IEEE format.
> 
> Can someone tell me if it's possible to get the Alpha to read/write
> IEEE in the right order?  I've tried cc with the -ieee switch, but
> that didn't do anything useful, and I tried gcc, and under VMS, I
> tried cc/float=ieee ..., all of which yielded the 'backwards' IEEE format.
> 
> [my immediate need is for reading IEEE binary format generated
> elsewhere, into a canned program, without wanting to write a byte
> re-ordering program...]
> 
> Thanks for any help
> 
> james

It's not the wrong order.  DECs are little-endian machines, whereas most
other Unix workstations, PCs and Macs are big-endian.  Little-endian
machines store data into memory in a different order than big-endian
machines.

One work-around is to use the htonl call before storing the data in a
file, but that may not be a good solution for your application.

-- 
Jim Griffin - TNS/AANR
griffin@voy.net
"You can fool all of the people some of the time ---
               and that's sufficient.



  parent reply	other threads:[~1997-07-24  4:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-23  4:00 DEC Unix 4.0 IEEE floating point on Alpha James Nau
1997-07-23  4:00 ` Paul DeMone
1997-07-24  4:00   ` Emmanuel Choquet
1997-07-24  4:00 ` A.Arnold
1997-07-24  4:00   ` fairfield
1997-07-25  4:00     ` Steve Lionel
1997-07-24  4:00 ` Jim Griffin [this message]
1997-07-26  4:00   ` John Hascall
1997-08-05  4:00   ` Eugene Y C Chu
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