From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,f17d8a20d2cce600,start X-Google-Attributes: gid1014db,public X-Google-Thread: 10b612,f17d8a20d2cce600,start X-Google-Attributes: gid10b612,public X-Google-Thread: 1164f8,f17d8a20d2cce600,start X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1993-01-28 20:53:59 PST Xref: sparky comp.unix.ultrix:9575 comp.sys.dec:7189 comp.lang.c:20353 Newsgroups: comp.unix.ultrix,comp.sys.dec,comp.lang.c Path: sparky!uunet!scifi!acheron!philabs!linus!agate!ames!eos!kozon From: kozon@eos.arc.nasa.gov (Tom Kozon) Subject: unix-ultrix VAX-IEEE number conversions Message-ID: <1993Jan28.201135.25383@eos.arc.nasa.gov> Organization: NASA Ames Research Center Distribution: usa Date: Thu, 28 Jan 1993 20:11:35 GMT Hello, I am currently in the process of porting some software from one system (DEC VAX 785 running BSD 4.3 unix) to another (Decsystem 5100 running ULTRIX RISC V4.2). Some of this software has the function of reading a binary stream of VAX data. While integer data types are read on the Decsystem with no difficulties, I am finding that I will need to convert floating point and double precision numbers from VAX into IEEE format. So far, I've written a couple of standalone test programs (running on the Decsystem) using the C library functions developed to do these conversions. I've been able to successfully use " ftoi " to make accurate floating point conversions with no problems. However, the function that transforms the double precision numbers (i.e., " dtoi ") seems to present some special difficulties. In general, it seems to convert a VAX double precision number into its IEEE format (mostly, but sometimes not), but almost never returns a " 0 " integer value indicating the conversion has been successfully made. According to the on-line documentation, if this function returns a non-zero value, it does not do the conversion. So, why would my experience be accurate transformations with nonzero function return values? The C program that uses dtoi generally works in the same manner as the one using ftoi, so these results seem surprising. Any suggestions/clues on this matter would be greatly appreciated -- thanks in advance for posted and/or E-mail replies! Tom kozon@eos.arc.nasa.gov