Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!amdahl!nsc!andrew From: andrew@nsc.nsc.com (Andrew Lue) Newsgroups: comp.lang.c Subject: unsigned int assigned to double yields negative # ... Why? Message-ID: <5020@nsc.nsc.com> Date: 17 Mar 88 22:41:52 GMT Organization: National Semiconductor, Sunnyvale Lines: 20 Keywords: conversions Using various C compilers on VAX and Series 32000 based machines, I've compiled the code below. I've gotten negative results instead of positive results. main() { unsigned int ui = 0xf0000000; double d; d = ui; printf("%d\n"); } The books by K&R and Harrison & Steele are unclear about how this conversion should be applied. Does anyone know what the definitive conversion is? Or is the decision left up to the compiler writers? -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Andrew H. Lue {decwrl|sun}!nsc!andrew