use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testToDouble.
@Test
public void testToDouble() {
Context context = context(MathContext.DECIMAL64);
assertEquals(3.14, context.valueOf(3.14).toDouble(), 0.0);
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testSubtract.
@Test
public void testSubtract() {
Context context = context(MathContext.DECIMAL32);
assertEquals(context.valueOf(2), context.valueOf(5).subtract(3));
assertEquals(context.valueOf(2), context.valueOf(5).subtract(3L));
assertEquals(context.valueOf(2), context.valueOf(5).subtract(3.0));
assertEquals(context.valueOf(2), context.valueOf(5).subtract(BigDecimal.valueOf(3)));
assertEquals(context.valueOf(2), context.valueOf(5).subtract(context.valueOf(3)));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testAcoth.
@Test
public void testAcoth() {
Context context = context(MathContext.DECIMAL32);
assertEquals(acoth(context.valueOf(1.1)).toBigDecimal(), BigDecimalMath.acoth(BigDecimal.valueOf(1.1), MathContext.DECIMAL32));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testCosh.
@Test
public void testCosh() {
Context context = context(MathContext.DECIMAL32);
assertEquals(cosh(context.valueOf(0)).toBigDecimal(), BigDecimalMath.cosh(BigDecimal.valueOf(0), MathContext.DECIMAL32));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatStreamTest method testRangeStep1.
@Test
public void testRangeStep1() {
Context context = BigFloat.context(20);
List<BigFloat> list = BigFloatStream.range(context.valueOf(0), context.valueOf(10), context.valueOf(1)).collect(Collectors.toList());
assertList(list, 0, 10);
}
Aggregations