473,654 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

strange output

mp
When printing a floating math result I sometimes get the following:

-1.#IND00

Can anyone tell what this means and how to avoid it?

Thank you,

Mar 9 '06 #1
4 4174
mp wrote:
When printing a floating math result I sometimes get the following:

-1.#IND00

Can anyone tell what this means and how to avoid it?

Thank you,

It doesn't mean anything to me. Can you give us more detail, some code
perhaps.

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Mar 9 '06 #2
On 2006-03-09, mp <mp****@wisc.ed u> wrote:
When printing a floating math result I sometimes get the following:

-1.#IND00

Can anyone tell what this means and how to avoid it?

Thank you,


<wild speculation>
Negative infinity?
Mar 9 '06 #3
mp
I am new to C.
This function is used to calculate a basic F-statistic.
Most of the time it works fine, once in a while it will fail with
several values
set to -1.#IND00.

double calcF(int *marker, int *groups, double *groupmean, double
*pheno, int numStrains, int Largest, double totalmean)
{
int gpctr = 0; // group iterator
/*************** ***** Count number in each group
*************** ************/
int m = 0;
int tmp = 0;
for(gpctr = 1; gpctr<=Largest; gpctr++)
{ tmp = 0;
for(m=0;m<numSt rains;m++)
{
if( gpctr == marker[m] )
{
tmp++;
}

}

}

/*************** ** Calc mean for each group *************** ********/
double tmpsum = 0.0;
for(gpctr = 1; gpctr<=Largest; gpctr++)
{
tmpsum = 0.0;
for(m=0;m<numSt rains;m++)
{
if( gpctr == marker[m])
{
tmpsum += pheno[m];
}
groupmean[gpctr] = (tmpsum/groups[gpctr]);

}

}
/*************** *************** *************** *************** *****/

double sstot = 0.0; //sum of squares total
double ssbet = 0.0; //sum of squares between
double ssw = 0.0; //sum of squares within
double dfbet = 0.0; // degrees of freedom between
double dfw = 0.0; // degrees of freedom within
double f = 0.0; // F-statistic

/******** CALC sum of square total *********/
double sstmp = 0.0;
for(m=0;m<numSt rains;m++)
{
sstmp += ((pheno[m] - totalmean) * (pheno[m] - totalmean) );

}
sstot = sstmp;

/******** CALC sum of square between *********/
sstmp = 0.0;

for(gpctr = 1; gpctr<=Largest; gpctr++)
{
sstmp += ((groupmean[gpctr] - totalmean) *
(groupmean[gpctr] - totalmean));
}
ssbet = sstmp; //########## THIS SOMETIMES SET TO -1.#IND00
/******** CALC sum of square within *********/

if( ssbet == 0)
{
ssw = sstot;
}else{
ssw = sstot - ssbet;
}
/******** CALC degrees of freedom *********/

dfbet = (Largest - 1);
dfw = (numStrains - Largest);
/******** Calc F-statistic *************** *********/
if(ssw == 0 || dfbet == 0 || dfw == 0 || ssbet == 0)
{
return f = 1000.1;
}else{

f = (ssbet/dfbet)/(ssw/dfw);

return f;
}

Mar 9 '06 #4
mp wrote:
When printing a floating math result I sometimes get the following:

-1.#IND00

Can anyone tell what this means and how to avoid it?

Thank you,


Don't know, but I get 99,300 hits for #IND00 from Google.

--
==============
*Not a pedant*
==============
Mar 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2149
by: Claudio | last post by:
hi all i put in this email source code so u can copy and paste to verify strange first : in this example bit size is a BYTE ?! second : in the last printf output is wrong ? ? best regards all
24
4734
by: LineVoltageHalogen | last post by:
Greetings All, I was hoping that someone out there has run into this issue before and can shed some light on it for me. I have a stored procedure that essentially does a mini ETL from a source OLTP DB to a the target Operational Data Store. This is still in development so both DB's reside on the same machine for convenience. The stored proc runs successfully from within Query analyzer and this holds true on the following platforms: XP...
8
1825
by: grundmann | last post by:
Hello, i got a strange compiler error. When compiling the following: // forward declarations typedef AvlTree<LineSegment,LineSegmentComperator> LSTree; void handleEventPoint (const EventPoint& , LSTree& , double&, std::list<IntersectionPoint>& );
8
2050
by: Victor Lamberty | last post by:
Greetings C coders I am new to the world of C and have been trying to compile this program. I got the result that I wanted but outputed it in a strange way it put it before the prompt is there a reason in this code. Or is that just a trait of the KDE Konsole. /*#I hope that this is a C program*/ /*#define hello-computer the output is hello-computer*/ #include <stdio.h>
6
8521
by: leonecla | last post by:
Hi everybody, I'm facing a very very strange problem with a very very simple C program... My goal should be to write to a binary file some numbers (integers), each one represented as a sequence of 32 bit. I made this stupid trial code: --------------------------------------------- FILE *fout;
1
1439
by: Martin Feuersteiner | last post by:
Dear Group I'm having a very weird problem. Any hints are greatly appreciated. I'm returning two values from a MS SQL Server 2000 stored procedure to my Webapplication and store them in sessions. Like This: prm4 = cmd1.CreateParameter With prm4
5
4067
by: soeren | last post by:
Hello, two days ago I stumbled across a very strange problem that came up when we were printing tiny double numbers as strings and trying to read them on another place. This is part of an object serialisation framework that cannot be done in binary format currently, so please no comments about this ,-)) It took quite some time to shrink down the problem but it looks like that C++ does not behave well in regards to very tiny numbers.
5
3103
by: Ian | last post by:
Hi everyone, I have found some bizarre (to me...!) behaviour of the Form_Activate function. I have a form which has a button control used to close the form and a subform with a datasheet view showing a list of jobs from the database. When the main form loses focus and the user clicks the 'Close' button, I kept receiving error 2585 (This action cannot be carried out whilst processing a form or report event). This was tracked down to...
4
1390
by: stat_holyday | last post by:
Greetings. I'm confused. I'm attemting to create dynamic buttons based on the count of questions in a database. The button has 3 states, blank, selected, and inactive. The script below works great, but with a strange bug that seems impossible to me. When the $question_count and $question_id are 2 or more values apart the script works, but when they are only 1 value apart, it bugs out. Examples...
2
1582
by: danep2 | last post by:
Hello all This is a really strange problem. I have code that performs a few calculations based on input from a joystick, and writes these values to a file using basically the following code: fprintf(fpResults, "i: %4.2f, j: %4.2f", i, j ); This works correctly (literally) 99.9999% of the time. However, once every million or so writes I get the following output:
0
8294
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8709
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1597
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.