🌐
GitHub
github.com › TilmanNeumann › java-math-library
GitHub - TilmanNeumann/java-math-library: A Java math library focused on number theory and integer factorization in particular.
A Java math library focused on number theory and integer factorization in particular. - TilmanNeumann/java-math-library
Starred by 33 users
Forked by 8 users
Languages   Java 100.0% | Java 100.0%
🌐
GitHub
github.com › SpongePowered › math
GitHub - SpongePowered/math: Immutable math library for Java that offers easy conversion between math types, fast trigonometric functions, vectors, matrices, complex numbers, quaternions, and operation chaining, with a focus on games and computer graphics.
Immutable math library for Java that offers easy conversion between math types, fast trigonometric functions, vectors, matrices, complex numbers, quaternions, and operation chaining, with a focus on games and computer graphics. - SpongePowered/math
Starred by 62 users
Forked by 15 users
Languages   Java 100.0% | Java 100.0%
🌐
GitHub
github.com › eobermuhlner › big-math
GitHub - eobermuhlner/big-math: Advanced Java BigDecimal math functions (pow, sqrt, log, sin, ...) using arbitrary precision.
Advanced Java BigDecimal math functions (pow, sqrt, log, sin, ...) using arbitrary precision. - eobermuhlner/big-math
Starred by 348 users
Forked by 44 users
Languages   Java 99.9% | Shell 0.1% | Java 99.9% | Shell 0.1%
🌐
GitHub
github.com › openjdk › jdk › blob › master › src › java.base › share › classes › java › lang › Math.java
jdk/src/java.base/share/classes/java/lang/Math.java at master · openjdk/jdk
package java.lang; · import java.math.BigDecimal; import java.util.Random; import jdk.internal.math.FloatConsts; import jdk.internal.math.DoubleConsts; import jdk.internal.vm.annotation.IntrinsicCandidate; · import static java.lang.Double.*; · /** * The class {@code Math} contains methods for performing basic ·
Author   openjdk
🌐
GitHub
github.com › frohoff › jdk8u-jdk › blob › master › src › share › classes › java › lang › Math.java
jdk8u-jdk/src/share/classes/java/lang/Math.java at master · frohoff/jdk8u-jdk
package java.lang; import java.util.Random; · import sun.misc.FloatConsts; import sun.misc.DoubleConsts; · /** * The class {@code Math} contains methods for performing basic · * numeric operations such as the elementary exponential, logarithm, * square root, and trigonometric functions.
Author   frohoff
🌐
GitHub
github.com › openjdk-mirror › jdk7u-jdk › blob › master › src › share › classes › java › lang › Math.java
jdk7u-jdk/src/share/classes/java/lang/Math.java at master · openjdk-mirror/jdk7u-jdk
package java.lang; import java.util.Random; · · /** * The class {@code Math} contains methods for performing basic · * numeric operations such as the elementary exponential, logarithm, * square root, and trigonometric functions. * * <p>Unlike some of the numeric methods of class ·
Author   openjdk-mirror
🌐
GitHub
github.com › carlsonp › JAMA
GitHub - carlsonp/JAMA: Java Matrix Package
Java Matrix Package · http://math.nist.gov/javanumerics/jama/ Version 1.02 · JAMA is released under the public domain. "This software is a cooperative product of The MathWorks and the National Institute of Standards and Technology (NIST) which has been released to the public domain.
Forked by 2 users
Languages   Java 100.0% | Java 100.0%
🌐
GitHub
github.com › nathanfunk › jep-java-gpl
GitHub - nathanfunk/jep-java-gpl: Java Math Expression Parser and Evaluator · GitHub
Jep Java parses and evaluates mathematical expressions with only a few lines of code. This package allows your users to enter a formula as a string, and instantly evaluate it. Jep supports user defined variables, constants, and functions.
Starred by 7 users
Forked by 3 users
Languages   Java 98.5% | HTML 1.1%
🌐
GitHub
github.com › topics › math-library
math-library · GitHub Topics · GitHub
java numerical library for Matrix, Integrals (numerical integration), derivatives (numerical differentiation), equations, ODE, polynomials, etc · integration functions equation series complex-numbers derivative differential-equations math-library ...
Find elsewhere
🌐
GitHub
github.com › whummer › java-utils › blob › master › misc › src › main › java › io › hummer › util › math › MathUtil.java
java-utils/misc/src/main/java/io/hummer/util/math/MathUtil.java at master · whummer/java-utils
package io.hummer.util.math; · import java.util.Arrays; import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.concurrent.atomic.AtomicReference; · import org.apache.commons.math.MathException; import org.apache.commons.math.distribution.TDistributionImpl; import org.apache.commons.math.stat.StatUtils; ·
Author   whummer
🌐
SourceForge
sourceforge.net › projects › jmathlibrary
Java Math Library download | SourceForge.net
Obsolete: use https://github.com/VMML/vmmlib · JUMP Ultimate Math Package · Java-based extensible high-precision math package. Includes support for computations based on fractions. Support is included for converting to floating point numbers and BigDecimals.
🌐
Java
download.java.net › java › early_access › panama › docs › api › java.base › java › math › package-summary.html
Package java.math
package java.math · Provides classes for performing arbitrary-precision integer arithmetic (BigInteger) and arbitrary-precision decimal arithmetic (BigDecimal). BigInteger is analogous to the primitive integer types except that it provides arbitrary precision, hence operations on BigIntegers ...
🌐
W3Schools
w3schools.com › java › java_math.asp
Java Math
assert abstract boolean break byte case catch char class continue default do double else enum exports extends final finally float for if implements import instanceof int interface long module native new package private protected public return requires short static super switch synchronized this throw throws transient try var void volatile while Java String Methods
🌐
Apache Commons
commons.apache.org › math
Math – Commons Math: The Apache Commons Mathematics Library
Commons Math is a library of lightweight, self-contained mathematics and statistics components addressing the most common problems not available in the Java programming language or Commons Lang · Download the Latest Release of Commons Math
🌐
GitHub
github.com › apache › commons-math
GitHub - apache/commons-math: Apache Commons Math · GitHub
More information can be found on the Apache Commons Math homepage. The Javadoc can be browsed.
Starred by 637 users
Forked by 379 users
Languages   Java 99.4% | R 0.5% | HTML 0.1% | CSS 0.0% | Gnuplot 0.0% | XSLT 0.0%
🌐
Reddit
reddit.com › r/java › how precise is java's math class?
r/java on Reddit: How precise is Java's Math class?
June 16, 2024 -

Was going to try to recreate the Black Scholes formula as a little side project in Java using BigDecimal but since BigDecimal doesn't come with much support for complex math such as logarithms, it just seems utterly impossible without reinventing the wheel and calling it BigWheel. Is double safe to use for money if I'm using Math class methods?

Top answer
1 of 24
177
The key thing to note is that BigDecimal is decimal. That is, it stores a precise representation of decimal (base-10) numbers. That is, the number is represented as a sum of powers of ten. float and double are binary (IEEE 754). That is, the number is represented as a sum of powers of two. Thus, when you translate a decimal fraction into a binary fraction, you'll end up with errors, because some decimal fractions cannot be represented exactly as binary fractions (within a given precision). These errors add up. The Math functions are intrinsics. They map directly to native routines, which operate on IEEE 754 floating point numbers. Obviously, most floating point units on processors work on IEEE floats (although, I think some older processors could do BCD math). BigDecimal is implemented purely in Java, trading performance for precision, and any math library operating on BigDecimal would have to reimplement all of those math operations in Java, similarly trading performance for precision, to a greater degree. Whether you choose float of BigDecimal depends on your goals. With money, generally the goal is precision, because of the financial consequences of errors in accounting calculations. But, in scientific and engineering application, the goal is reasonable approximation within an error range. I don't think with Black-Sholes you're looking for precision, but approximation. Thus, it is perfectly fine to use float as long as you arrange your calculations to control the error range. Poor arrangement of floating point calculations can significantly widen the error range, resulting wildly deviating results. For this reason, there are books like Numerical Computing with IEEE Floating Point Arithmetic which show you how to arrange floating point calculations to maintain accuracy within a desired error range. EDITED: I don't write good.
2 of 24
66
Floating point arithmetic is fine for financial analysis. You're just not supposed to use it for accounting purposes.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-math-class
Java Math Class - GeeksforGeeks
July 23, 2025 - Java.lang.Math Class methods help to perform numeric operations like square, square root, cube, cube root, exponential and trigonometric operations.
🌐
Tutorialspoint
tutorialspoint.com › java › math › index.htm
Java.math package Tutorial
Java.math package provides classes for performing arbitrary-precision integer arithmetic (BigInteger) and arbitrary-precision decimal arithmetic (BigDecimal). This reference will take you through simple and practical methods available in java.math package.
🌐
Reddit
reddit.com › r/adventofcode › java math libraries?
r/adventofcode on Reddit: Java math libraries?
December 26, 2023 -

One thing I learned this year is that maybe I should figure out how to use some math libraries/packages.

There are two problems that I ended up using a little outside help with. One was doing a polyfit. Especially, I have a list of input values and output results and I want the computer to tell me a function that matches. This is good for things where I'm sure there is a simple math relation, I just can't see it. For example in one problem, I had a series of numbers and needed polyfit to tell me I was actually looking at 5 + 2x + x^2 or something like that.

I ended up using python and numpy for that, which worked but I'd like to add that sort of capability to my Java tool kit.

The other, I kinda worked around but it would be nice to have is a symbolic math solver.

I've poked at Symja which has a enticing named solver:
https://bitbucket.org/axelclk/symja_android_library/wiki/Solve

But I'm having trouble getting the dependencies to run. Anyone have anything they like?

In case it matters, I'm using bazel to build, which means I can easily include anything that is on maven.

🌐
Baeldung
baeldung.com › home › java › java numbers › a guide to the java math class
A Guide to the Java Math Class | Baeldung
January 8, 2024 - In this article, we’ve described the APIs that Java provides for mathematical operations. The code backing this article is available on GitHub.