Login  Register

Re: RS_Painter::toGui crashes

Posted by dxli on Mar 19, 2025; 1:16am
URL: https://forum.librecad.org/RS-Painter-toGui-crashes-tp5726734p5726739.html

The assertion is triggered due to tight ULP comparison, I have relaxed the assertion tolerance to 1E-12, which is much tighter than 1E-10 used throughout.

The assertion is not triggered with 1E-12 tolerance. I guess 1E-13 would work as well, but there's no point to be paranoid. By reviewing the code, it's clearly those two versions are equivalent.

While the equivalence is not always up to the ULP level, this is not accumulative here (meaning the output would feekback to the algorithm repeatededly).

The lesson is to use ULP comparison with care. In this particular case, there's probably no need to optimize at the ULP level. If needed, optimization up to ULP can be done by kaham summation, but there's no point to that here.

https://github.com/LibreCAD/LibreCAD/commit/e6f74e4e00a689a07fee738f036f2fa6805c304a


sand1024 wrote
Hm... however, as far as I can see by the screenshot, there is no rotation... And this is strange, so it seems that the difference may occur even if there is shift only? Anyway, please try my sample file