use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testAdd.
@Test
public void testAdd() {
Context context = context(MathContext.DECIMAL32);
assertEquals(context.valueOf(5), context.valueOf(2).add(3));
assertEquals(context.valueOf(5), context.valueOf(2).add(3L));
assertEquals(context.valueOf(5), context.valueOf(2).add(3.0));
assertEquals(context.valueOf(5), context.valueOf(2).add(BigDecimal.valueOf(3)));
assertEquals(context.valueOf(5), context.valueOf(2).add(context.valueOf(3)));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testGetIntegralPart.
@Test
public void testGetIntegralPart() {
Context context = context(MathContext.DECIMAL32);
assertEquals(context.valueOf(123), context.valueOf(123.456).getIntegralPart());
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testSinh.
@Test
public void testSinh() {
Context context = context(MathContext.DECIMAL32);
assertEquals(sinh(context.valueOf(0)).toBigDecimal(), BigDecimalMath.sinh(BigDecimal.valueOf(0), MathContext.DECIMAL32));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testExp.
@Test
public void testExp() {
Context context = context(MathContext.DECIMAL32);
assertEquals(exp(context.valueOf(3)).toBigDecimal(), BigDecimalMath.exp(BigDecimal.valueOf(3), MathContext.DECIMAL32));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testSqrt.
@Test
public void testSqrt() {
Context context = context(MathContext.DECIMAL32);
assertEquals(sqrt(context.valueOf(3)).toBigDecimal(), BigDecimalMath.sqrt(BigDecimal.valueOf(3), MathContext.DECIMAL32));
}
Aggregations