Skip to content
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

DM-21697 Fix SpanSet Creation from large circles #514

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

natelust
Copy link
Contributor

@natelust natelust commented Feb 5, 2020

Fix an issue where data-types were not large enough to hold values
that may be plausibly used.

{
double dr = static_cast<double>(r);
dr *= dr;
for (auto dy = std::make_pair<int, double>(-r, -r); dy.first <= r; ++dy.first, ++dy.second) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some C++ style guides frown on applying the increment/decrement operators to floating-point values. However, I don't think the LSST style guide mentions this.

Still, dy.second += 1.0 might help the reader understand the nature of the parallelism a bit more.

int dx = static_cast<int>(sqrt(r * r - dy * dy));
tempVec.push_back(Span(dy + offset.getY(), -dx + offset.getX(), dx + offset.getX()));
{
double dr = static_cast<double>(r);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a comment is necessary to clarify what problem is being avoided by the parallel increment of the integer and the double. And I might name the variable that holds "r-squared" something like r_sq.

@timj timj force-pushed the tickets/DM-21697 branch 2 times, most recently from bd9067d to 95cf2c2 Compare February 7, 2023 19:26
Fix an issue where data-types were not large enough to hold values
that may be plausibly used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants