Subject: Re: toolchain/21414: double to unsigned int conversion broken
To: David Laight <david@l8s.co.uk>
From: Martin Husemann <martin@duskware.de>
List: netbsd-bugs
Date: 05/01/2003 20:48:44
On Thu, May 01, 2003 at 07:35:42PM +0100, David Laight wrote:
> Someone better check the C standard closely, K&R2 says:
> 
>     "When a value of floating type in converted to integral type, the
>     fractional part is discarded; if the resulting value cannot be
>     represented in the integral type, the behaviour is undefined."
> 
> So 0x7fffffff is fine...

Duh, you are right.

 oul = (unsigned int)(unsigned long)dtemp;

works fine.

Martin