use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testLog.
@Test
public void testLog() {
Context context = context(MathContext.DECIMAL32);
assertEquals(log(context.valueOf(3)).toBigDecimal(), BigDecimalMath.log(BigDecimal.valueOf(3), MathContext.DECIMAL32));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testToInt.
@Test
public void testToInt() {
Context context = context(MathContext.DECIMAL64);
assertEquals(1234, context.valueOf(1234).toInt());
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testFactorial.
@Test
public void testFactorial() {
Context context = context(MathContext.DECIMAL32);
assertEquals(context.valueOf(720), context.factorial(6));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testMax.
@Test
public void testMax() {
Context context = context(MathContext.DECIMAL32);
assertEquals(context.valueOf(9), max(context.valueOf(9), context.valueOf(2)));
assertEquals(context.valueOf(9), max(context.valueOf(2), context.valueOf(9)));
assertEquals(context.valueOf(9), max(context.valueOf(2), context.valueOf(9), context.valueOf(3)));
assertEquals(context.valueOf(9), max(context.valueOf(9), context.valueOf(2), context.valueOf(3)));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testPow2.
@Test
public void testPow2() {
Context context = context(MathContext.DECIMAL32);
assertEquals(context.valueOf(2).pow(3).toBigDecimal(), BigDecimalMath.pow(BigDecimal.valueOf(2), BigDecimal.valueOf(3), MathContext.DECIMAL32));
}
Aggregations