From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,353213c6ba11774a X-Google-Attributes: gid1164f8,public From: fairfield@sldb4.slac.stanford.edu Subject: Re: DEC Unix 4.0 IEEE floating point on Alpha Date: 1997/07/24 Message-ID: <1997Jul24.122022.1@sldb4.slac.stanford.edu>#1/1 X-Deja-AN: 258548929 Distribution: world References: <5r5qt6$gd8@crcnis3.unl.edu> <5r732p$9n@zam201.zam.kfa-juelich.de> Organization: Stanford Linear Accelerator Center Newsgroups: comp.sys.dec In article <5r732p$9n@zam201.zam.kfa-juelich.de>, arnold@zam331.kfa-juelich.de (A.Arnold) writes: > >>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. [...] > If you want to portably read and write binary data over different platforms, > you have to do the 'byte mirroring' yourself on architectures that do not > use the endianess you use in your files (I personally work on Alphas and > Intels most of the time, so my binary files are 'little endian' and I have > to convert on a big-endian machine...). For example, the following routine > converts an array of 4-byte values (doesn't matter if they are floats or > ints): Perhaps a better solution is to use the "convert float" routines available on DU (and OpenVMS). Sorry that I can't recall the exact name on DU; its a run-time library routine called CVT$CONVERT_FLOAT on OVMS. By using this routine for all input and output of binary data, you can maintain a single external source form, e.g., big-endian & IEEE floats, etc. The routine does many more conversions than these, but for the problem at hand... -Ken -- Kenneth H. Fairfield | Internet: Fairfield@Slac.Stanford.Edu SLAC, P.O.Box 4349, MS 46 | DECnet: 45537::FAIRFIELD (45537=SLACVX) Stanford, CA 94309 | Voice: 415-926-2924 FAX: 415-926-3515 ------------------------------------------------------------------------- These opinions are mine, not SLAC's, Stanford's, nor the DOE's...