Search in sources :

Example 11 with Context

use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.

the class BigFloatTest method testAcot.

@Test
public void testAcot() {
    Context context = context(MathContext.DECIMAL32);
    assertEquals(acot(context.valueOf(0)).toBigDecimal(), BigDecimalMath.acot(BigDecimal.valueOf(0), MathContext.DECIMAL32));
}
Also used : MathContext(java.math.MathContext) Context(ch.obermuhlner.math.big.BigFloat.Context) Test(org.junit.Test)

Example 12 with Context

use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.

the class BigFloatTest method testAbs.

@Test
public void testAbs() {
    Context context = context(MathContext.DECIMAL32);
    assertEquals(context.valueOf(3), abs(context.valueOf(3)));
    assertEquals(context.valueOf(3), abs(context.valueOf(-3)));
}
Also used : MathContext(java.math.MathContext) Context(ch.obermuhlner.math.big.BigFloat.Context) Test(org.junit.Test)

Example 13 with Context

use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.

the class BigFloatTest method testAcosh.

@Test
public void testAcosh() {
    Context context = context(MathContext.DECIMAL32);
    assertEquals(acosh(context.valueOf(1.1)).toBigDecimal(), BigDecimalMath.acosh(BigDecimal.valueOf(1.1), MathContext.DECIMAL32));
}
Also used : MathContext(java.math.MathContext) Context(ch.obermuhlner.math.big.BigFloat.Context) Test(org.junit.Test)

Example 14 with Context

use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.

the class BigFloatTest method testIsLessThan.

@Test
public void testIsLessThan() {
    Context context = context(MathContext.DECIMAL32);
    assertEquals(true, context.valueOf(1).isLessThan(context.valueOf(5)));
    assertEquals(false, context.valueOf(5).isLessThan(context.valueOf(1)));
    assertEquals(false, context.valueOf(5).isLessThan(context.valueOf(5)));
}
Also used : MathContext(java.math.MathContext) Context(ch.obermuhlner.math.big.BigFloat.Context) Test(org.junit.Test)

Example 15 with Context

use of ch.obermuhlner.math.big.BigFloat.Context in project big-math by eobermuhlner.

the class BigFloatTest method testIsIntValue.

@Test
public void testIsIntValue() {
    Context context = context(MathContext.DECIMAL32);
    assertEquals(true, context.valueOf(0).isIntValue());
    assertEquals(true, context.valueOf(123).isIntValue());
    assertEquals(false, context.valueOf(123E99).isIntValue());
    assertEquals(false, context.valueOf(123.456).isIntValue());
    assertEquals(false, context.valueOf(0.456).isIntValue());
}
Also used : MathContext(java.math.MathContext) Context(ch.obermuhlner.math.big.BigFloat.Context) Test(org.junit.Test)

Aggregations

Context (ch.obermuhlner.math.big.BigFloat.Context)78 Test (org.junit.Test)76 MathContext (java.math.MathContext)61 BigFloat (ch.obermuhlner.math.big.BigFloat)15