Advertisement

What is bigger?

Started by February 13, 2011 07:02 PM
21 comments, last by Endurion 13 years, 8 months ago

I think the whole exercise is meaningless; this is like comparing Chuck Norris with Vien Diesel, or pirates with ninjas, or cats with dogs, and so on.

Plural Ninjas > Chuck >= Diesel > single ninja > pirates > cats > dogs > NULL

Wait, what was the original question?
Well if you think about it bitwise, like if these 2 "values" were being loaded into a register...

NULL is just 0

NaN is nonzero

thus NaN is bigger!

If you are talking about including signed integers though, I'm not sure if NaN has the highest bit set or not. If so, NULL would be bigger :/
Advertisement
What is bigger, mine or yours?
... wait. What were we comparing now again? Auch, who cares! NULL is so much cooler than NaN!
"I will personally burn everything I've made to the fucking ground if I think I can catch them in the flames."
~ Gabe
"I don't mean to rush you but you are keeping two civilizations waiting!"
~ Cavil, BSG.
"If it's really important to you that other people follow your True Brace Style, it just indicates you're inexperienced. Go find something productive to do."
[size=2]~ Bregma

"Well, you're not alone.


There's a club for people like that. It's called Everybody and we meet at the bar[size=2]."


[size=2]~ [size=1]Antheus


NULL is just 0

NaN is nonzero

thus NaN is bigger!

If you are talking about including signed integers though, I'm not sure if NaN has the highest bit set or not. If so, NULL would be bigger :/


NULL isn't just 0.

The value of ((void*)0) that you feed to the compiler is magically transformed into a null pointer constant that is appropriate for the system. NULL can be many different sizes and different values even on a single system. It can simultaneously be 8-bit, 9-bit, 16-bit, 32-bit, 48-bit, 54-bit, 64-bit, 80-bit, and more in order to fill any pointing need. It can simultaneously be all zero-bits and also non-zero. It is very Zen.


The compiler understands the magic and compares your ((void*)0) with the proper form and function of the currently active null pointer constant.


NULL can be various sizes, and can be many different values. While it *MIGHT* just be a 32-bit zero, it can also be many other shapes and sizes. A system with 64-bit pointers in the process may use 64 bits, not just 32, so right there it's already more beefy than a simple float's 32-bit NaN. As you are cross-platform NULL transforms to the size and value appropriate for the device, even when the zero address is a legal address and therefore not valid for NULL. Once you get into kernel programming NULL can be expanded out to 80 bits or more depending on the underlying architecture with a high probability of being non-zero, especially once you add details to the pointer for it's assigned process and/or processor. NaN is just a single numeric constant, but NULL is many different things even within a single context.

NULL > Chuck Norris > NAN.
Mmmm, true that ((void*)0) may not be zeroes, but rather something like 0xcdcdcdcd or other values which in the architecture context it refers to invalid "zero'ed" address.

[quote name='Tachikoma' timestamp='1297700136' post='4774134']
I think the whole exercise is meaningless; this is like comparing Chuck Norris with Vien Diesel, or pirates with ninjas, or cats with dogs, and so on.

Plural Ninjas > Chuck >= Diesel > single ninja > pirates > cats > dogs > NULL
[/quote]

Where do hard cats and long dogs fit into that?
Advertisement
Ninja cat-dogs > everything else.

Ninja cat-dogs are not a number.

Ergo, not a number is greater than NULL.

QED.
Ich verstehe nicht so ganz, was das "Auch" dort bedeuten soll.

Well if you think about it bitwise, like if these 2 "values" were being loaded into a register...

NULL is just 0

NaN is nonzero

thus NaN is bigger!


NaN is neither nonzero, nor isn't it nonzero. Dividing anything by NaN yields NaN again, which is neither nonzero, nor isn't it nonzero, nor is it infinity. Whereas when you divide a non-zero number by NULL, the result will be infinity. Therefore, the real question is whether NaN not being infinity not or not not being infinity is worth more than x/NULL, with x!=0, which always gives infinity.

Wait. ... ...

Theeeeeerefore, NaN is bigger. NULL means invalid, but the result of a computation that uses NULL as one of the operands is not necessarily invalid, whereas NaN always stays NaN, never mind you push or pull or accumulate or pop it.

Hear ye: NaN is he true dominator of thy scientific number cruncher, whereas the fool NULL hides deep deep in thy pipeline.
If we are going to care about capitalization, summing the value of their characters yields:
NaN = 253
NULL = 315
<_< >_>

This topic is closed to new replies.

Advertisement