-
-
Save controlflow/5a6d672263cf298483b45bc1bf380f2c to your computer and use it in GitHub Desktop.
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
| [Pure] | |
| private static bool IsNegativeInfinity([NotNull] ICSharpExpression expression) | |
| { | |
| var constantValue = expression.ConstantValue.Value; | |
| if (constantValue is double) | |
| return double.IsNegativeInfinity((double) constantValue); | |
| if (constantValue is float) | |
| return float.IsNegativeInfinity((float) constantValue); | |
| return false; | |
| } |
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
| [Pure] | |
| private static bool IsNegativeInfinity([NotNull] ICSharpExpression expression) | |
| { | |
| switch (expression.ConstantValue.Value) | |
| { | |
| case double x: | |
| return double.IsNegativeInfinity(x); | |
| case float x: | |
| return float.IsNegativeInfinity(x); | |
| default: | |
| return false; | |
| } | |
| } |
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
| [Pure] | |
| private static bool IsNegativeInfinity([NotNull] ICSharpExpression expression) => | |
| match (expression.ConstantValue.Value) | |
| { | |
| case double x => double.IsNegativeInfinity(x); | |
| case float x => float.IsNegativeInfinity(x); | |
| default => false; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment