Search in sources :

Example 16 with Context

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

the class BigFloatTest method testIsGreaterThanOrEqual.

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

Example 17 with Context

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

the class BigFloatTest method testIsNegative.

@Test
public void testIsNegative() {
    Context context = context(MathContext.DECIMAL32);
    assertEquals(true, context.valueOf("-1E999").isNegative());
    assertEquals(true, context.valueOf("-1E-999").isNegative());
    assertEquals(true, context.valueOf(-5).isNegative());
    assertEquals(false, context.valueOf(0).isNegative());
    assertEquals(false, context.valueOf("0.000000").isNegative());
    assertEquals(false, context.valueOf(5).isNegative());
    assertEquals(false, context.valueOf("1E999").isNegative());
    assertEquals(false, context.valueOf("1E-999").isNegative());
}
Also used : MathContext(java.math.MathContext) Context(ch.obermuhlner.math.big.BigFloat.Context) Test(org.junit.Test)

Example 18 with Context

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

the class BigFloatTest method testTan.

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

Example 19 with Context

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

the class BigFloatTest method testTanh.

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

Example 20 with Context

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

the class BigFloatTest method testCos.

@Test
public void testCos() {
    Context context = context(MathContext.DECIMAL32);
    assertEquals(cos(context.valueOf(0)).toBigDecimal(), BigDecimalMath.cos(BigDecimal.valueOf(0), MathContext.DECIMAL32));
}
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