Path: utzoo!attcan!uunet!ogicse!uwm.edu!rpi!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!oakhill!billl From: billl@oakhill.UUCP (Bill Ledbetter) Newsgroups: comp.lang.perl Subject: RE: problems with pack/unpack Keywords: pack unpack perl sun3 Message-ID: <3125@jupiter.oakhill.UUCP> Date: 21 Mar 90 19:35:29 GMT Organization: Motorola Inc. Austin, Tx Lines: 34 (I tried to mail this yesterday, but it looks like it got lost.) After receiving some news that the pack/unpack script I posted worked on other machines, I began to look a little further. I found that the sun3 compilers did not seem to handle the (unsigned int) cast required by the pack operator properly. The following code fragment shows the problem: main() { double f0; unsigned int u0, u1; int i0, i1; u0 = 0x89abcdef; printf("U0:%08x\n", u0); i0 = (int)u0; f0 = (double)i0; printf("F0: %f I0:%08x\n", f0, i0); u1 = (unsigned int)f0; i1 = (int)f0; printf("U1:%08x I1:%08x\n", u1, i1); } When this is compiled without the 68881, the u1 variable gets 0 from the coercion. With the 68881, u1 gets the proper value. For now, I will always compile with the -f68881 flag! --------------------------------------------------------------------------- Bill Ledbetter Motorola Inc. MD OE37 email: cs.utexas.edu!oakhill!billl 6501 William Cannon Dr. West Austin, TX 78735-8598