For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

OCC6.1 infinite loop in math_FunctionRoots

Jeanmi B's picture


in the constructor of math_FunctionRoots (at line 428) there is a while loop to search for a minimum of a function:
while(Abs(x3-x0) > tolCR*(Abs(x1)+Abs(x2)) && (Abs(x1 -x2) > 0)) {

Unfortunately I come into this loop with very small values for all x (about 1.E-7). And as the loop "advance" x1 get very close to x2 but never enough to end the loop.
The test Abs(x1 -x2) > 0 is equivalent to x1 = x2 (in my case because I have positive values).
Everyone know that this kind of test must be prohibited when dealing with floating point values, and that we could not reach the exact equality.

I have change the test into the following :
Abs(x1 -x2) >tolCR

And everything goes right now.


Jean Michel

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.