Created
March 2, 2020 20:11
-
-
Save controlflow/6e44259f7e737b57750b1d34ac09b7da 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
public override AbstractValueWithInfo Divide(AbstractValue divisor) | |
{ | |
switch (divisor) | |
{ | |
case Scalar otherScalar when (otherScalar.Value == 0): | |
return AbstractValueWithInfo.DivisionByZero; | |
case Scalar otherScalar when (otherScalar.Value == 1): | |
return new AbstractValueWithInfo(this, ErrorType.DivisionByOne); | |
case Scalar otherScalar: | |
var result = Divide(myInterval, otherScalar.Value); | |
return new AbstractValueWithInfo(new Interval(result)); |
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
public override AbstractValueWithInfo Divide(AbstractValue divisor) | |
{ | |
switch (divisor) | |
{ | |
case Scalar(0): | |
return AbstractValueWithInfo.DivisionByZero; | |
case Scalar(1): | |
return new AbstractValueWithInfo(this, ErrorType.DivisionByOne); | |
case Scalar(var scalar): | |
var result = Divide(myInterval, scalar); | |
return new AbstractValueWithInfo(new Interval(result)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment