-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Update example output for .NET (10) #51304
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6e9e0ca
update example output for .net
gewarren 7d16865
fix mistake
gewarren 61c563e
respond to feedback
gewarren 86b04fb
add project file
gewarren 01f587e
fix fsharp project file
gewarren 12d8c86
actually add missing project file
gewarren 38b7cc5
reset changes to Double snippets
gewarren 6808701
compile errors
gewarren 22040c4
fix project file
gewarren 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
15 changes: 7 additions & 8 deletions
15
docs/fundamentals/runtime-libraries/snippets/System/Single/Overview/csharp/comparison2.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 |
|---|---|---|
| @@ -1,21 +1,20 @@ | ||
| // <Snippet10> | ||
| using System; | ||
|
|
||
| public class Example1 | ||
| { | ||
| public static void Main() | ||
| { | ||
| // <Snippet10> | ||
| float value1 = 10.201438f; | ||
| value1 = (float)Math.Sqrt((float)Math.Pow(value1, 2)); | ||
| float value2 = (float)Math.Pow((float)value1 * 3.51f, 2); | ||
| value2 = ((float)Math.Sqrt(value2)) / 3.51f; | ||
| Console.WriteLine($"{value1} = {value2}: {value1.Equals(value2)}"); | ||
| Console.WriteLine(); | ||
| Console.WriteLine($"{value1:G9} = {value2:G9}"); | ||
|
|
||
| // The example displays the following output on .NET: | ||
| // 10.201438 = 10.201439: False | ||
| // The example displays the following output on .NET Framework: | ||
| // 10.20144 = 10.20144: False | ||
| // </Snippet10> | ||
| } | ||
| } | ||
| // The example displays the following output: | ||
| // 10.20144 = 10.20144: False | ||
| // | ||
| // 10.201438 = 10.2014389 | ||
| // </Snippet10> |
9 changes: 5 additions & 4 deletions
9
docs/fundamentals/runtime-libraries/snippets/System/Single/Overview/csharp/comparison3.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 |
|---|---|---|
| @@ -1,18 +1,19 @@ | ||
| // <Snippet11> | ||
| using System; | ||
|
|
||
| public class Example2 | ||
| { | ||
| public static void Main() | ||
| { | ||
| // <Snippet11> | ||
| float value1 = .3333333f; | ||
| float value2 = 1.0f / 3; | ||
| int precision = 7; | ||
| value1 = (float)Math.Round(value1, precision); | ||
| value2 = (float)Math.Round(value2, precision); | ||
| Console.WriteLine($"{value1:R} = {value2:R}: {value1.Equals(value2)}"); | ||
|
|
||
| // The example displays the following output: | ||
| // 0.3333333 = 0.3333333: True | ||
| // </Snippet11> | ||
| } | ||
| } | ||
| // The example displays the following output: | ||
| // 0.3333333 = 0.3333333: True | ||
| // </Snippet11> |
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
11 changes: 6 additions & 5 deletions
11
docs/fundamentals/runtime-libraries/snippets/System/Single/Overview/csharp/exceptional1.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 |
|---|---|---|
| @@ -1,18 +1,19 @@ | ||
| // <Snippet1> | ||
| using System; | ||
|
|
||
| public class Example6 | ||
| { | ||
| public static void Main() | ||
| { | ||
| // <Snippet1> | ||
| float value1 = 1.163287e-36f; | ||
| float value2 = 9.164234e-25f; | ||
| float result = value1 * value2; | ||
| Console.WriteLine($"{value1} * {value2} = {result}"); | ||
| Console.WriteLine($"{result} = 0: {result.Equals(0.0f)}"); | ||
|
|
||
| // The example displays the following output: | ||
| // 1.163287E-36 * 9.164234E-25 = 0 | ||
| // 0 = 0: True | ||
| // </Snippet1> | ||
| } | ||
| } | ||
| // The example displays the following output: | ||
| // 1.163287E-36 * 9.164234E-25 = 0 | ||
| // 0 = 0: True | ||
| // </Snippet1> |
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
11 changes: 6 additions & 5 deletions
11
docs/fundamentals/runtime-libraries/snippets/System/Single/Overview/csharp/precisionlist1.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 |
|---|---|---|
| @@ -1,16 +1,17 @@ | ||
| // <Snippet5> | ||
| using System; | ||
|
|
||
| public class Example8 | ||
| public class Example9 | ||
| { | ||
| public static void Main() | ||
| { | ||
| // <Snippet5> | ||
| Double value1 = 1 / 3.0; | ||
| Single sValue2 = 1 / 3.0f; | ||
| Double value2 = (Double)sValue2; | ||
| Console.WriteLine($"{value1:R} = {value2:R}: {value1.Equals(value2)}"); | ||
|
|
||
| // The example displays the following output on .NET: | ||
| // 0.3333333333333333 = 0.3333333432674408: False | ||
| // </Snippet5> | ||
| } | ||
| } | ||
| // The example displays the following output: | ||
| // 0.33333333333333331 = 0.3333333432674408: False | ||
| // </Snippet5> |
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
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.