Subject: Re: toolchain/21414: double to unsigned int conversion broken
To: Martin Husemann <martin@duskware.de>
From: Andrey Petrov <petrov@netbsd.org>
List: netbsd-bugs
Date: 05/01/2003 21:24:18
On Thu, May 01, 2003 at 10:53:04PM +0200, Martin Husemann wrote:
> On Thu, May 01, 2003 at 07:47:02PM +0000, Andrey Petrov wrote:
> > And as you said this operation is undefined by K&R2.
>
> All well and true, but this is easy to fix in libc, at least for the unsigned
> 32 bit case. I'll do that, if noone objects.
>
> The question is: does ISO C define this whole conversion to be unsigned or
> not? I'm unsure because float is involved.
>
That is what is not specified (i think). Floats are always signed and can
be big numbers so the conversion is troublesome. From common sense one might
expect unsigned->float->unsigned to give the original value. Well,
certainly it's not always possible.
No objection on my side.
Andrey