From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,eb58654c5683eea0 X-Google-Attributes: gid1164f8,public From: pedasmith@aol.com (Pedasmith) Subject: Re: VAX D-Float format Date: 1997/10/31 Message-ID: <19971031140400.JAA29755@ladder02.news.aol.com>#1/1 X-Deja-AN: 286177211 References: <3458B45F.167E@blighty.com> X-Admin: news@aol.com Organization: AOL http://www.aol.com Newsgroups: comp.sys.dec In article <3458B45F.167E@blighty.com>, Steve Atkins writes: >Ugly, ugly, ugly untested code. This should all be done >with structures. This is a really good example as to how >not to write bit twiddling code. > >- As a developer who both [a] has written vax<-->ieee converters and [b] had to fix other developers "improvements" to my code and [c] happened to be the only person to *test* their float conversions: Thorough testing is important! [1] Make sure you try different bit patterns in each byte [2] The code if (x != ieee2vax (vax2ieee (x)) won't actually test the conversion -- it will only ensure that you've got symetrical errors. That is, ieee2vax might put the bytes in the wrong order, only to have vax2ieee swap them back. Peter Smith And above all, ".5" is a _very_ bad test value