use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testIsLessThanOrEqual.
@Test
public void testIsLessThanOrEqual() {
Context context = context(MathContext.DECIMAL32);
assertEquals(true, context.valueOf(1).isLessThanOrEqual(context.valueOf(5)));
assertEquals(false, context.valueOf(5).isLessThanOrEqual(context.valueOf(1)));
assertEquals(true, context.valueOf(5).isLessThanOrEqual(context.valueOf(5)));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testCompareTo.
@Test
public void testCompareTo() {
Context context = context(MathContext.DECIMAL32);
assertEquals(1, context.valueOf(5).compareTo(context.valueOf(1)));
assertEquals(-1, context.valueOf(1).compareTo(context.valueOf(5)));
assertEquals(0, context.valueOf(5).compareTo(context.valueOf(5)));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testPow.
@Test
public void testPow() {
Context context = context(MathContext.DECIMAL32);
assertEquals(context.valueOf(8), context.valueOf(2).pow(3));
assertEquals(context.valueOf(8), context.valueOf(2).pow(3L));
assertEquals(context.valueOf(8), context.valueOf(2).pow(3.0));
assertEquals(context.valueOf(8), context.valueOf(2).pow(BigDecimal.valueOf(3)));
assertEquals(context.valueOf(8), context.valueOf(2).pow(context.valueOf(3)));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testRoot2.
@Test
public void testRoot2() {
Context context = context(MathContext.DECIMAL32);
assertEquals(context.valueOf(8).root(3).toBigDecimal(), BigDecimalMath.root(BigDecimal.valueOf(8), BigDecimal.valueOf(3), MathContext.DECIMAL32));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testLog2.
@Test
public void testLog2() {
Context context = context(MathContext.DECIMAL32);
assertEquals(log2(context.valueOf(3)).toBigDecimal(), BigDecimalMath.log2(BigDecimal.valueOf(3), MathContext.DECIMAL32));
}
Aggregations