R
ramu
Hi,
Can you please tell me how to access a integer of size 4bytes in
a 16bit architecture?
Regards
Can you please tell me how to access a integer of size 4bytes in
a 16bit architecture?
Regards
Can you please tell me how to access a integer of size 4bytes in
a 16bit architecture?
Nick Keighley said:long has to be at least 32 bits
unsigned long has to be at least 32 bits.
long can be as little as 31.9999999996640964- bits.
Tom St Denis said:While I realize you're trying to be funny, long still represents 2^32
values, even though the absolute maximum is half that of an unsigned
long. So no, a long MUST be at least 32 bits.
long has to be at least 32 bits
While I realize you're trying to be funny, long still represents 2^32
values, even though the absolute maximum is half that of an unsigned
long. So no, a long MUST be at least 32 bits.
Tim Rentsch said:unsigned long has to be at least 32 bits.
long can be as little as 31.9999999996640964- bits.
While I realize you're trying to be funny, long still represents 2^32
values, even though the absolute maximum is half that of an unsigned
long. So no, a long MUST be at least 32 bits.
Sign-bit representation is allowed, so it may only be able to represent
2^32-1 distinct values. log[2](2^32-1) = 31.9999999996640964...
The point of the joke is that long might have only (2**32 - 1) values
rather than (2**32) values.
Tom said:There are 2^n values between 0 and 2^n - 1 inclusively.
Tom St Denis said:There are 2^n values between 0 and 2^n - 1 inclusively.
representations have two distinct representations for 0.)= +2147483647. (ones' complement and sign-and-magnitude
Stay in school kids.
Eric Sosman said:Keith said:[...]
The joke is that these 2**32-1 distinct values can be represented
in log2(2**32-1), or about 31.9999999996641, bits.
... but a representation involving "fractional bits" would not
meet the requirements of 6.2.6.2p2,
so can we drop this silly
sub-thread?
Richard said:In
You still need a bit of entropy for the sign bit. And anyways ... 0On Wed, 21 Oct 2009 04:50:20 -0700, Tom St Denis wrote:
long has to be at least 32 bits
unsigned long has to be at least 32 bits.
long can be as little as 31.9999999996640964- bits.
While I realize you're trying to be funny, long still represents
2^32 values, even though the absolute maximum is half that of an
unsigned long. So no, a long MUST be at least 32 bits.
Sign-bit representation is allowed, so it may only be able to
represent 2^32-1 distinct values. log[2](2^32-1) =
31.9999999996640964...
to 2^31 - 1 inclusive is 2^31 values, there are 2^31 negative
values. That's 2^32 unique values.
Maybe I'm not getting your math failures?
Maybe you're not getting *your* math failures - or rather, your C
failures. LONG_MIN can be as "high" as -2147483647; on such a system,
there are only 4294967295 distinct values, not 4294967296. That is
the whole point of the joke.
bartc said:I don't understand. Are you saying a signed value can be as little as one
bit if the representation uses 31 bits for a sign?
In
On Wed, 21 Oct 2009 04:50:20 -0700, Tom St Denis wrote:
long has to be at least 32 bits
unsigned long has to be at least 32 bits.
long can be as little as 31.9999999996640964- bits.
While I realize you're trying to be funny, long still represents
2^32 values, even though the absolute maximum is half that of an
unsigned long. So no, a long MUST be at least 32 bits.
Sign-bit representation is allowed, so it may only be able to
represent 2^32-1 distinct values. log[2](2^32-1) =
31.9999999996640964...You still need a bit of entropy for the sign bit. And anyways ... 0
to 2^31 - 1 inclusive is 2^31 values, there are 2^31 negative
values. That's 2^32 unique values.Maybe I'm not getting your math failures?
Maybe you're not getting *your* math failures - or rather, your C
failures. LONG_MIN can be as "high" as -2147483647; on such a system,
there are only 4294967295 distinct values, not 4294967296. That is
the whole point of the joke.
>> > Sign-bit representation is allowed, so it may only be able to represent
> > 2^32-1 distinct values. log[2](2^32-1) =3D 31.9999999996640964...
> You still need a bit of entropy for the sign bit. And anyways ... 0
> to 2^31 - 1 inclusive is 2^31 values, there are 2^31 negative values.
> That's 2^32 unique values.
...
> > Sign-bit representation is allowed, so it may only be able to represent
> > 2^32-1 distinct values. log[2](2^32-1) =3D 31.9999999996640964....
>
> You still need a bit of entropy for the sign bit. And anyways ... 0
> to 2^31 - 1 inclusive is 2^31 values, there are 2^31 negative values.
> That's 2^32 unique values.
But between 1 - 2^31 and 2^31 - 1 inclusive is 2^32 - 1 unique values.
On the other hand, I have encountered a 2's complement machine where
the most negative value was 1 - 2^31 because what would otherwise be
the most negative value acted as a trap representation.
>> > But between 1 - 2^31 and 2^31 - 1 inclusive is 2^32 - 1 unique values.
> >
> > On the other hand, I have encountered a 2's complement machine where
> > the most negative value was 1 - 2^31 because what would otherwise be
> > the most negative value acted as a trap representation.
> yeah yeah yeah I get it. It's all academic anyways since essentially
> all platforms nowadays don't do that. All of ARM, PPC, MIPS, and x86
> [which makes up the vast majority of 32/64-bit processors] have at
> least a 32-bit range for signed longs.
> yeah yeah yeah I get it. It's all academic anyways since essentially
> all platforms nowadays don't do that. All of ARM, PPC, MIPS, and x86
> [which makes up the vast majority of 32/64-bit processors] have at
> least a 32-bit range for signed longs.
Actually having a trap representation there can be pretty helpful in
detecting unassigned variables. And, of course, negation always works.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.