use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testNegate.
@Test
public void testNegate() {
Context context = context(MathContext.DECIMAL32);
assertEquals(context.valueOf(-3), negate(context.valueOf(3)));
assertEquals(context.valueOf(3), negate(context.valueOf(-3)));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testSin.
@Test
public void testSin() {
Context context = context(MathContext.DECIMAL32);
assertEquals(sin(context.valueOf(0)).toBigDecimal(), BigDecimalMath.sin(BigDecimal.valueOf(0), MathContext.DECIMAL32));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testAcos.
@Test
public void testAcos() {
Context context = context(MathContext.DECIMAL32);
assertEquals(acos(context.valueOf(0)).toBigDecimal(), BigDecimalMath.acos(BigDecimal.valueOf(0), MathContext.DECIMAL32));
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testToLong.
@Test
public void testToLong() {
Context context = context(MathContext.DECIMAL64);
assertEquals(1234L, context.valueOf(1234).toLong());
}
use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.
the class BigFloatTest method testIsPositive.
@Test
public void testIsPositive() {
Context context = context(MathContext.DECIMAL32);
assertEquals(false, context.valueOf("-1E999").isPositive());
assertEquals(false, context.valueOf("-1E-999").isPositive());
assertEquals(false, context.valueOf(-5).isPositive());
assertEquals(false, context.valueOf(0).isPositive());
assertEquals(false, context.valueOf("0.000000").isPositive());
assertEquals(true, context.valueOf(5).isPositive());
assertEquals(true, context.valueOf("1E999").isPositive());
assertEquals(true, context.valueOf("1E-999").isPositive());
}
Aggregations