Re: Binary number
CBFalconer wrote:[color=blue]
> Peter Nilsson wrote:[color=green]
> > CBFalconer wrote:[color=darkred]
> >> ...
> >> What issue? A value of LONG_MIN is immediately converted to an
> >> unsigned long with a '-' sign emitted.[/color]
> >
> > The conversion of LONG_MIN to unsigned long may yield 0.
> >
> > It's not likely to on any implementation in existance, but
> > the standard allows it. [Genuine strictly conforming itoa
> > functions have previously been posted to clc.][/color]
>
> I see no way for a non-zero integer to be converted to zero.
> Show me. Remember that ULONG_MAX has to be odd, as implied
> by the imposed weighted bit construction.[/color]
6.2.6.2p2 "...(if there are M value bits in the signed type
and N in the unsigned type, then M <= N). ..."
Thus, ULONG_MAX == LONG_MAX is allowed by the standards (other
constraints notwithstanding .) On such a machine, conversion of
LONG_MIN to unsigned long may produce 0.
--
Peter
CBFalconer wrote:[color=blue]
> Peter Nilsson wrote:[color=green]
> > CBFalconer wrote:[color=darkred]
> >> ...
> >> What issue? A value of LONG_MIN is immediately converted to an
> >> unsigned long with a '-' sign emitted.[/color]
> >
> > The conversion of LONG_MIN to unsigned long may yield 0.
> >
> > It's not likely to on any implementation in existance, but
> > the standard allows it. [Genuine strictly conforming itoa
> > functions have previously been posted to clc.][/color]
>
> I see no way for a non-zero integer to be converted to zero.
> Show me. Remember that ULONG_MAX has to be odd, as implied
> by the imposed weighted bit construction.[/color]
6.2.6.2p2 "...(if there are M value bits in the signed type
and N in the unsigned type, then M <= N). ..."
Thus, ULONG_MAX == LONG_MAX is allowed by the standards (other
constraints notwithstanding .) On such a machine, conversion of
LONG_MIN to unsigned long may produce 0.
--
Peter
Comment