From 326b3e283a40b0967ccf6c4560a96ffdfc23d799 Mon Sep 17 00:00:00 2001 From: nbv Date: Wed, 9 Nov 2016 11:22:12 +0300 Subject: [PATCH] 0028076: Test bugs moddata_2 bug469 fails when FPE are enabled The reason of FPE exception has been eliminated. --- src/ApproxInt/ApproxInt_KnotTools.cxx | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/ApproxInt/ApproxInt_KnotTools.cxx b/src/ApproxInt/ApproxInt_KnotTools.cxx index 7d7a77d021..b8bf254ad2 100644 --- a/src/ApproxInt/ApproxInt_KnotTools.cxx +++ b/src/ApproxInt/ApproxInt_KnotTools.cxx @@ -57,17 +57,33 @@ static Standard_Real EvalCurv(const Standard_Real dim, mp += p*p; } } - //mp *= 2.; //P(j,i) = -P(i,j); - mp = Sqrt(mp); // Standard_Real q = 0.; for(i = 0; i < dim; ++i) { q += V1[i]*V1[i]; } - q = Sqrt(q); + + if (q < 1 / Precision::Infinite()) + { + // Indeed, if q is small then we can + // obtain equivocation of "0/0" type. + // In this case, local curvature can be + // not equal to 0 or Infinity. + // However, it is good solution to insert + // knot in the place with such singularity. + // Therefore, we need imitation of curvature + // jumping. Return of Precision::Infinite() is + // enough for it. + + return Precision::Infinite(); + } + + q = Min(q, Precision::Infinite()); + q *= q*q; + // - Standard_Real curv = mp / (q*q*q); + Standard_Real curv = Sqrt(mp / q); return curv; }