-
Notifications
You must be signed in to change notification settings - Fork 227
fix: avoid warnings for coordinate conversions and unused parameters #1379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
tinko92
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, I commented two things which are both minor. Given that you want it in 1.88 and it is a long-standing bug, I'm in favour of merging regardless of the resolution of my comments, so I selected "Approve".
eb2ae6f to
7562d44
Compare
7562d44 to
ab495c3
Compare
|
One more thought on this: I can see this change affects the coordinate type in the context of side-by-triangle, which evaluates a second-degree polynomial. The integer promotion promotes to an integral type with twice the digits, which will make this evaluate without integer overflow if the coordinate_type were e.g. an int32_t and the input geometry fully uses the range, the predicate would be evaluated in int64_t without overflow. For int64_t without int128 or a multiprecision type, this is not possible. I think the choice of giving floating-poitn a priority above integer in Converting coordinates that use the full range of Evaluating a second degree polynomial in side by triangle in So this change, exchanges a valid warning, that is only relevant if the Edit: I guess, this can also be addressed later. It shouldn't be too troubleseome to catch that case by testing the coordinates size in advance and calling a slower fall-back side by triangle for the special case of both |
vissarion
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also agree with merging.
Yes, going to double had some merit indeed. But I still think we should not have done it. Originally we didn’t. I don’t remember when it was changed - but the “integer” world is to be fully safe, without having FP issues in the calculations. Therefore the side should be stable, and operator on input=integer, output=integer. Same for other calculations. The intersections can fall off the grid, of course, but they are rounded. So integer should stay integer, as much as possible. And then you are right, whenever we multiply integers, we need to have the space for it. That was also discussed, long ago, with the “customer” (in this case: @vschoech). They (from Thinkcell) are aware to not use the full range of int64_t. But we should indeed document it properly. That either only part of a range can be used, or promotion should be possible and successful (for example, we could promote to Boost.Multiprecision using that define). |
Fixes: #629
This was a long standing warning where we were pinged about several times.
I think this is the best solution at the moment. However, it solves one case. There is the message:
I cannot fix all of that now, it first have to wait at least for the big improvement in intersections.
Then we probably should fix it in
select_most_preciseitself.Please give me your opinions.
If possible it should be included in
1.88