-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Provide support for alternative rounding modes for division and remainder of division #106795
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
Open
AlexRadch
wants to merge
7
commits into
dotnet:main
Choose a base branch
from
AlexRadch:DivisionRounding
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d2c5662
Provide support for alternative rounding modes for division and remai…
AlexRadch 80ff9b2
IBinaryInteger DivRem optimization
AlexRadch 78b0f68
Removed external links from documentation comments.
AlexRadch 809e6c7
retrigger checks
AlexRadch 4f7c885
Merge branch 'main' into DivisionRounding
AlexRadch 4e6c359
Fix casing in DivisionRounding.cs file path
AlexRadch 5f1aef9
Merge branch 'main' into DivisionRounding
tannergooding File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/libraries/System.Private.CoreLib/src/System/Numerics/DivisionRounding.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||
| // Licensed to the .NET Foundation under one or more agreements. | ||||||
| // The .NET Foundation licenses this file to you under the MIT license. | ||||||
|
|
||||||
| namespace System.Numerics | ||||||
| { | ||||||
| /// <summary> | ||||||
| /// Specifies the rounding strategy to use when performing division. | ||||||
| /// </summary> | ||||||
| public enum DivisionRounding | ||||||
| { | ||||||
| /// <summary> | ||||||
| /// Truncated division (rounding toward zero) — round the division result towards zero. | ||||||
| /// Graph for truncated division with positive divisor https://www.wolframalpha.com/input?i=Plot%5B%7BIntegerPart%5Bn%5D%2C+n+-+IntegerPart%5Bn%5D%7D%2C+%7Bn%2C+-3%2C+3%7D%5D | ||||||
| /// Graph for truncated division with negative divisor https://www.wolframalpha.com/input?i=Plot%5B%7BIntegerPart%5B-n%5D%2C+n+%2B+IntegerPart%5B-n%5D%7D%2C+%7Bn%2C+-3%2C+3%7D%5D | ||||||
| /// </summary> | ||||||
| Truncate = 0, | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// Floor division (rounding down) — round the division result down to the next lower integer. | ||||||
| /// Graph for floor division with positive divisor https://www.wolframalpha.com/input?i=Plot%5B%7BFloor%5Bn%5D%2C+n+-+Floor%5Bn%5D%7D%2C+%7Bn%2C+-3%2C+3%7D%5D | ||||||
| /// Graph for floor division with negative divisor https://www.wolframalpha.com/input?i=Plot%5B%7BFloor%5B-n%5D%2C+n+%2B+Floor%5B-n%5D%7D%2C+%7Bn%2C+-3%2C+3%7D%5D | ||||||
| /// </summary> | ||||||
| Floor = 1, | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// Ceiling division (rounding up) — round the division result up to the next higher integer. | ||||||
| /// Graph for ceiling division with positive divisor https://www.wolframalpha.com/input?i=Plot%5B%7BCeiling%5Bn%5D%2C+n+-+Ceiling%5Bn%5D%7D%2C+%7Bn%2C+-3%2C+3%7D%5D | ||||||
| /// Graph for ceiling division with negative divisor https://www.wolframalpha.com/input?i=Plot%5B%7BCeiling%5B-n%5D%2C+n+%2B+Ceiling%5B-n%5D%7D%2C+%7Bn%2C+-3%2C+3%7D%5D | ||||||
| /// </summary> | ||||||
| Ceiling = 2, | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// AwayFromZero division (rounding away zero — round the division result away from zero to the nearest integer. | ||||||
|
||||||
| /// AwayFromZero division (rounding away zero — round the division result away from zero to the nearest integer. | |
| /// AwayFromZero division (rounding away zero) — round the division result away from zero to the nearest integer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.