Search in sources :

Example 16 with ExtendedRational

use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.

the class ExtendedRationalTest method testDivisionNumber.

@Test
public void testDivisionNumber() {
    ExtendedRational a = ExtendedRational.ofString("2/4");
    ExtendedRational b = ExtendedRational.ofString("1/4");
    assertThat(a.divides(b)).isEqualTo(new ExtendedRational(Rational.ofLong(2)));
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Test(org.junit.Test)

Example 17 with ExtendedRational

use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.

the class ExtendedRationalTest method testDivisionNaN.

@Test
public void testDivisionNaN() {
    ExtendedRational a = ExtendedRational.ofString("234234");
    ExtendedRational b = ExtendedRational.NaN;
    assertThat(a.divides(b)).isEqualTo(ExtendedRational.NaN);
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Test(org.junit.Test)

Example 18 with ExtendedRational

use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.

the class ExtendedRationalTest method testMultiplicationInfty.

@Test
public void testMultiplicationInfty() {
    ExtendedRational a = ExtendedRational.ofString("100/4");
    ExtendedRational b = ExtendedRational.ofString("Infinity");
    assertThat(a.times(b)).isEqualTo(ExtendedRational.INFTY);
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Test(org.junit.Test)

Example 19 with ExtendedRational

use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.

the class ExtendedRationalTest method testDivisionNegInfty.

@Test
public void testDivisionNegInfty() {
    ExtendedRational a = ExtendedRational.ofString("234234");
    ExtendedRational b = ExtendedRational.NEG_INFTY;
    assertThat(a.divides(b)).isEqualTo(new ExtendedRational(Rational.ofLong(0)));
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Test(org.junit.Test)

Example 20 with ExtendedRational

use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.

the class ExtendedRationalTest method testMultiplication2.

@Test
public void testMultiplication2() {
    ExtendedRational a = ExtendedRational.ofString("100/4");
    ExtendedRational b = ExtendedRational.ofString("1/100");
    assertThat(a.times(b)).isEqualTo(new ExtendedRational(Rational.ofLongs(1, 4)));
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)23 ExtendedRational (org.sosy_lab.common.rationals.ExtendedRational)23 Var (com.google.errorprone.annotations.Var)2