Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!nosc!ucsd!ncr-sd!matt From: matt@ncr-sd.SanDiego.NCR.COM (Matt Costello) Newsgroups: comp.lang.c Subject: Re: BUG - unsigned long cast to double Message-ID: <2590@ncr-sd.SanDiego.NCR.COM> Date: 31 Aug 88 03:03:23 GMT References: <1239500001@osiris.cso.uiuc.edu> Organization: NCR Corporation, Rancho Bernardo Lines: 18 In article <1239500001@osiris.cso.uiuc.edu> olson@osiris.cso.uiuc.edu writes: >The problem involves casting unsigned long to double. The Pyramid and >Masscomp compilers treat the cast as SIGNED long to double. If the >value is large enough, you have troubles. The problem has existed in PCC since the beginning, as the PDP-11 did not readily support 32 bit integers. The few double-word instructions, including the floating point conversions, only supported signed values. Neither the VAX nor the M68881 support conversions to or from unsigned values either. The code sequences to handle the unsigned long to double conversion (and vice versa) would have imposed an unacceptable performace penalty, so it wasn't done. I don't have my K&R here, but I don't even believe that unsigned longs were legal back then. -- Matt Costello +1 619 485 2926 {ucsd,att,pyramid,nosc.mil}!ncr-sd!matt