Search in sources :

Example 86 with MathContext

use of java.math.MathContext in project big-math by eobermuhlner.

the class FunctionTable method printTableAcos.

public static void printTableAcos() {
    MathContext mathContext = new MathContext(20);
    printTable(-1, 1, 0.01, Arrays.asList("BigDecimalMath.acos", "Math.acos"), Arrays.asList(x -> BigDecimalMath.acos(x, mathContext), x -> BigDecimal.valueOf(Math.acos(x.doubleValue()))));
}
Also used : BigDecimal(java.math.BigDecimal) Arrays(java.util.Arrays) List(java.util.List) MathContext(java.math.MathContext) BigDecimalMath(ch.obermuhlner.math.big.BigDecimalMath) Function(java.util.function.Function) MathContext(java.math.MathContext)

Example 87 with MathContext

use of java.math.MathContext in project big-math by eobermuhlner.

the class FunctionTable method printTableLog.

public static void printTableLog() {
    MathContext mathContext = new MathContext(20);
    printTable(0, 10, 0.1, Arrays.asList("BigDecimalMath.log", "Math.log"), Arrays.asList(x -> BigDecimalMath.log(x, mathContext), x -> BigDecimal.valueOf(Math.log(x.doubleValue()))));
}
Also used : BigDecimal(java.math.BigDecimal) Arrays(java.util.Arrays) List(java.util.List) MathContext(java.math.MathContext) BigDecimalMath(ch.obermuhlner.math.big.BigDecimalMath) Function(java.util.function.Function) MathContext(java.math.MathContext)

Example 88 with MathContext

use of java.math.MathContext in project big-math by eobermuhlner.

the class FunctionTable method printTableExp.

public static void printTableExp() {
    MathContext mathContext = new MathContext(20);
    printTable(0, 10, 0.1, Arrays.asList("BigDecimalMath.exp", "Math.exp"), Arrays.asList(x -> BigDecimalMath.exp(x, mathContext), x -> BigDecimal.valueOf(Math.exp(x.doubleValue()))));
}
Also used : BigDecimal(java.math.BigDecimal) Arrays(java.util.Arrays) List(java.util.List) MathContext(java.math.MathContext) BigDecimalMath(ch.obermuhlner.math.big.BigDecimalMath) Function(java.util.function.Function) MathContext(java.math.MathContext)

Example 89 with MathContext

use of java.math.MathContext in project big-math by eobermuhlner.

the class FunctionTable method printTableAtan.

public static void printTableAtan() {
    MathContext mathContext = new MathContext(20);
    printTable(-1, 1, 0.01, Arrays.asList("BigDecimalMath.atan", "Math.atan"), Arrays.asList(x -> BigDecimalMath.atan(x, mathContext), x -> BigDecimal.valueOf(Math.atan(x.doubleValue()))));
}
Also used : BigDecimal(java.math.BigDecimal) Arrays(java.util.Arrays) List(java.util.List) MathContext(java.math.MathContext) BigDecimalMath(ch.obermuhlner.math.big.BigDecimalMath) Function(java.util.function.Function) MathContext(java.math.MathContext)

Example 90 with MathContext

use of java.math.MathContext in project big-math by eobermuhlner.

the class FunctionTable method printTableLog10.

public static void printTableLog10() {
    MathContext mathContext = new MathContext(5);
    printTable(0, 100, 1, Arrays.asList("BigDecimalMath.log10", "Math.log10"), Arrays.asList(x -> BigDecimalMath.log10(x, mathContext), x -> BigDecimal.valueOf(Math.log(x.doubleValue()) / Math.log(10))));
}
Also used : BigDecimal(java.math.BigDecimal) Arrays(java.util.Arrays) List(java.util.List) MathContext(java.math.MathContext) BigDecimalMath(ch.obermuhlner.math.big.BigDecimalMath) Function(java.util.function.Function) MathContext(java.math.MathContext)

Aggregations

MathContext (java.math.MathContext)237 BigDecimal (java.math.BigDecimal)224 RoundingMode (java.math.RoundingMode)73 BigInteger (java.math.BigInteger)71 List (java.util.List)9 Test (org.junit.Test)8 BigDecimalMath (ch.obermuhlner.math.big.BigDecimalMath)7 Arrays (java.util.Arrays)7 Function (java.util.function.Function)7 StopWatch (ch.obermuhlner.math.big.example.StopWatch)3 IOException (java.io.IOException)3 Random (java.util.Random)3 Context (ch.obermuhlner.math.big.BigFloat.Context)2 FileWriter (java.io.FileWriter)2 PrintWriter (java.io.PrintWriter)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 RandomDataGenerator (org.apache.commons.math3.random.RandomDataGenerator)2 Well19937c (org.apache.commons.math3.random.Well19937c)2 DataCell (org.knime.core.data.DataCell)2