Re: A little unrelated but it's a question about C :)
- From: Alexandre Fayolle <Alexandre Fayolle logilab fr>
- To: Marco Quezada <mquezada nlxcorp com>
- Cc: GTK List <gtk-app-devel-list gnome org>
- Subject: Re: A little unrelated but it's a question about C :)
- Date: Tue, 6 Feb 2001 10:03:14 +0100 (CET)
On Mon, 5 Feb 2001, Marco Quezada wrote:
Hi,
I'm trying to debug a program and I need to have a printf statement that
will get called when a float variable turns into NaN.
I tried something like
if(VARIABLE == NULL)
{
printf("%d" , Called_Function_Id);
}
But the compiler doesn't like it. Is there a way to catch a NaN value
like that?
math.h defines a bunch of useful functions:
int isinf (double value); returns -1 if value is -infinite, +1 if
it is +infinite and 0 otherwise
int isnan (double value); returns true if value is NaN, and 0
otherwise
int finite (double value); returns true is value is numeric and finite,
and 0 otherwise.
Check the manpage for one of those three functions for more information.
Alexandre Fayolle
--
http://www.logilab.com
Narval is the first software agent available as free software (GPL).
LOGILAB, Paris (France).
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]