Domain error in sqrt

Please excuse the cross post from qnx4.devtools but I was wondering if
anyone has seen this as well under Neutrino:

Can anyone help me with this? I know most people are in the qnxrtp camp
already but I have a QNX 4.25 system delivered to a customer. I’m piping
the output of my TCP/IP server to a file using:
server > server.start 2>&1
After a few days of running, and my customer sending me TCP/IP commands,
we are seeing the following error message in my log:
Domain error in sqrt

My initial thought was that it was coming from one of the sqrt functions in
my program. But to test I wrote a small test program and ran it:

int main()
{
double fTest = -1.00;
double fResult = 0.00;

fResult=sqrt(fTest);
printf(“fResult = sqrt(fTest) = sqrt(%f) = %f\n”,fTest,fResult);
}

This doesn’t show the error string I’m seeing. Any ideas?? Is this a
dump/flush issue?!?

Jeff

Good afternoon,

The math docs aren’t really clear on this, but what is happening is that
errno is being set. If you want to test for errors, using math functions,
set errno to 0 before calling the function, and test against it afterwards.
This is also the case with some wide character functions, such as wcscxfrm.

/* Sample Redux */
int main()
{
double fTest = -1.00;
double fResult = 0.00;

errno = 0;
fResult=sqrt(fTest);
if (0 != errno)
{
printf ("%s in sqrt\n",strerror (errno));
}
printf(“fResult = sqrt(fTest) = sqrt(%f) = %f\n”,fTest,fResult);
}

Cheers,
-Brian

+===============================+
Brian K. Hlady
OEM Support Rep
QNX Software Systems, Ltd.
bhlady@qnx.com
+===============================+

“Jeff Holtz” <holtzj@mediaone.net> wrote in message
news:a2rsel$m6j$1@inn.qnx.com

Please excuse the cross post from qnx4.devtools but I was wondering if
anyone has seen this as well under Neutrino:

Can anyone help me with this? I know most people are in the qnxrtp camp
already but I have a QNX 4.25 system delivered to a customer. I’m piping
the output of my TCP/IP server to a file using:
server > server.start 2>&1
After a few days of running, and my customer sending me TCP/IP commands,
we are seeing the following error message in my log:
Domain error in sqrt

My initial thought was that it was coming from one of the sqrt functions
in
my program. But to test I wrote a small test program and ran it:

int main()
{
double fTest = -1.00;
double fResult = 0.00;

fResult=sqrt(fTest);
printf(“fResult = sqrt(fTest) = sqrt(%f) = %f\n”,fTest,fResult);
}

This doesn’t show the error string I’m seeing. Any ideas?? Is this a
dump/flush issue?!?

Jeff
\

Anwered in qnx4.devtools

“Jeff Holtz” <holtzj@mediaone.net> wrote in message
news:a2rsel$m6j$1@inn.qnx.com

Please excuse the cross post from qnx4.devtools but I was wondering if
anyone has seen this as well under Neutrino:

Can anyone help me with this? I know most people are in the qnxrtp camp
already but I have a QNX 4.25 system delivered to a customer. I’m piping
the output of my TCP/IP server to a file using:
server > server.start 2>&1
After a few days of running, and my customer sending me TCP/IP commands,
we are seeing the following error message in my log:
Domain error in sqrt

My initial thought was that it was coming from one of the sqrt functions
in
my program. But to test I wrote a small test program and ran it:

int main()
{
double fTest = -1.00;
double fResult = 0.00;

fResult=sqrt(fTest);
printf(“fResult = sqrt(fTest) = sqrt(%f) = %f\n”,fTest,fResult);
}

This doesn’t show the error string I’m seeing. Any ideas?? Is this a
dump/flush issue?!?

Jeff
\