Skip to content

fix math.d for 16997#5793

Merged
dlang-bot merged 2 commits intodlang:masterfrom
WalterBright:ROUNDING_MASK
Oct 20, 2017
Merged

fix math.d for 16997#5793
dlang-bot merged 2 commits intodlang:masterfrom
WalterBright:ROUNDING_MASK

Conversation

@WalterBright
Copy link
Member

Blocking dlang/dmd#7013

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

std/math.d Outdated
auto old = FloatingPointControl.getControlState();
FloatingPointControl.setControlState(
(old & ~FloatingPointControl.ROUNDING_MASK) | FloatingPointControl.roundToZero
(old & (-1-FloatingPointControl.ROUNDING_MASK)) | FloatingPointControl.roundToZero
Copy link
Member

Choose a reason for hiding this comment

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

Why not a cast instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

I like this better, as it will invoke the compiler's normal integral promotion. I try to avoid casts if I can.

Copy link
Member

Choose a reason for hiding this comment

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

spaces around binary -...

Copy link
Member

@andralex andralex left a comment

Choose a reason for hiding this comment

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

I did the monor edit myself

std/math.d Outdated
auto old = FloatingPointControl.getControlState();
FloatingPointControl.setControlState(
(old & ~FloatingPointControl.ROUNDING_MASK) | FloatingPointControl.roundToZero
(old & (-1-FloatingPointControl.ROUNDING_MASK)) | FloatingPointControl.roundToZero
Copy link
Member

Choose a reason for hiding this comment

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

spaces around binary -...

@dlang-bot dlang-bot merged commit bd49f40 into dlang:master Oct 20, 2017
@WalterBright WalterBright deleted the ROUNDING_MASK branch October 20, 2017 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants