[Fwd: Re: [Verse-dev] verse build (in blender) fails....]

Emil Brink emil at obsession.se
Wed Aug 23 11:42:12 CEST 2006


Emil Brink wrote:
>> Care to comment?
> 
> Correct me if I'm wrong, But NAN exists in C++ but not in C. C has INF
> and C++ has NAN.

I'm not sure what you mean by "exists". NAN is not a language-level
construct, it is part of the IEEE standard for floating point numbers.

The standard defines exactly which bits should be set for the number to
be NAN.

There is a C function called isnan(), which is standard since C99, is
definitely available in GCC, and seems to be so in Microsoft's compiler
as well.

I have found a way of relibably setting a floating point variable to NAN,
and it works the same for doubles (the conversion from float-NAN to double-
NAN is automatic).

> C thinks that divided by zero is legal because the
> answer can be expressed, while C++ don't. Other tricky thing is that C
> supports both INF and -INF, and i think both of them are NAN in C++.

Does that matter? Not sure I see how ... All we're after is a float (and
double) value we can reserve to mean magic things in the network. I think
reserving a value which is not a number, and thus can never be used by
a user trying to express actual geometry, makes more sense than reserving
some arbitrary MAX number, which *is* a valid number, and also proven to
be hard to port across platforms.

> So for starters we should swap to INF rather then NAN, if we should
> switch, but i have to do some more thinking on the subject.

I really don't agree. INF is far "closer" to being a number, than NAN is.
NAN is simply a special value that can be in a floating point variable,
but that does not have a mathematically meaningful interpretation.

It really is not a number, just as the name says. Unlike INF, NAN is not
even equal to itself (which is why isnan() is useful).

> I think one reason why MAX is better then INF, is that INF is easier
> to accidentally send. People who accidentally send INF could be very
> confused with what verse does.

So then we shouldn't swap to INF either? Of course, if someone sends
NAN by mistake, they might be confused, but I think it makes sense to
say in the Verse standard that NAN is reserved by the system and cannot
reliably be used as a vertex coordinate or in polygon layer data.

Regards,

/Emil



More information about the Verse-dev mailing list