RE: not_bits() not_working()
rolf at rschr.de wrote:
>
>
> Al Getz wrote:
>
> > atom a,x
> > a=2
> >
> > x=not_bits(a)
> >
> > --now x equals -3, which isnt correct.
>
>
> It is correct! look at this (or try it yourself):
> ---------------------------------------------------
> printf(1,"%08x\n", 2 ) -- 00000002
> printf(1,"%08x\n", not_bits(2) ) -- FFFFFFFD
> ---------------------------------------------------
>
> Please notice also:
>
> 0000 0000 0000 0000 0000 0000 0000 0010 = 2 = #00000002
> 1111 1111 1111 1111 1111 1111 1111 1101 = -3 = #FFFFFFFD
>
> Have a nice day, Rolf
>
Hi Rolf,
I think you will find that the results of the printf statement
using the '%x' hex formatter is very very misleading.
Just because it 'displays' the correct hex value doesnt mean
it's stored internally in a form that is correct for using
with the other _bit functions. Strange for sure
In order to be certain, you have to print the number out
two times: once using the '%x' formatter and once using the
'%d' formatter (or just '?').
Try that and note what the results are and how they differ.
Take care for now,
Al
|
Not Categorized, Please Help
|
|