Friday, 15 January 2010

c - Convenient FLAG for limit of a sequence -



c - Convenient FLAG for limit of a sequence -

i wrote function returns limit of sequence if exists.

i homecoming flag when sequence doesn't converge (infinite limit).

how can define flag? can't take random value because there probability value equals limits of sequence, there aùbiguity.

thanks.

using nan signal special reply easy utilize (as suggested @ deduplicator).

double find_limit() { double limit = ... if (limit_not_found) homecoming 0.0/0.0; // form nan or utilize macro/constant here homecoming limit; } void foo() { double y = find_limit(); if (y != y) puts("no limit found"); // nan not equal else the_happypath(); }

c sequence flags

No comments:

Post a Comment