Sign in to follow this  

Floats, Lists = Problem

Recommended Posts

Hi all sorry for the vuage header but I did not really know what to put for it. Problem in a nutshell, I print out the value which I return from a class which is stored in a list and it says its value is 0.0000f then right after I print out the value I have a IF statement which checks if the float value is <= to 0. But the code in the if statement does not get executed!?! To add insult to injury I also do the same for a class that two elements behind it, it prints out zero, and enters the if statement. Does ant one know whats going on. I declare the list and the itterators like this
list<class CFuzzLLineMF> m_listMembershipFuncCtnr;
list<class CFuzzLLineMF>::iterator m_PrevlistIterMembershipFuncCtnr;
list<class CFuzzLLineMF>::iterator m_listIterMembershipFuncCtnr;
list<class CFuzzLLineMF>::iterator m_NextlistIterMembershipFuncCtnr;

then later in the code in a for loop i do this
	for(int i = 0; i < (m_iMaxNumberOfMF-1); i++)
		if( i > 0)
			m_PrevlistIterMembershipFuncCtnr = m_listMembershipFuncCtnr.begin();

		m_listIterMembershipFuncCtnr = m_listMembershipFuncCtnr.begin();

		if(i < (m_iMaxNumberOfMF-1))
			m_NextlistIterMembershipFuncCtnr = m_listMembershipFuncCtnr.begin();

		if(( i > 0) && (i < (m_iMaxNumberOfMF-1)))
			if(i == 1)
				char Test[256];




				if(m_PrevlistIterMembershipFuncCtnr->Rtn_MembershipDegree_f() <= FLT_EPSILON)

				if(m_NextlistIterMembershipFuncCtnr->Rtn_MembershipDegree_f() <= FLT_EPSILON)

When the code gets executed m_PrevlistIterMembershipFuncCtnr->Rtn_MembershipDegree_f() returns 0.0f which gets displayed in the message box, m_listIterMembershipFuncCtnr->Rtn_MembershipDegree_f() returns 1.0f and m_NextlistIterMembershipFuncCtnr->Rtn_MembershipDegree_f() returns 0.0f in the if statement where i check if the value from m_PrevlistIterMembershipFuncCtnr->Rtn_MembershipDegree_f() is <= to Zero it acknowledges tha values as being Zero and dislays the message box, but it does not with the value returned from m_NextlistIterMembershipFuncCtnr->Rtn_MembershipDegree_f() any ideas whats up?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this