标签 数学运算 下的文章

内容

  • 基本的独立数学函数根据涉及的主要数字类型分为IntMathLongMathDoubleMathBigIntegerMath。这些类具有并行结构,但每个类只支持函数的相关子集。请注意,在com.google.common.primitives类中也可以找到类似的函数,它们本质上不那么数学化。
  • 为单个和成对的数据集提供了各种统计计算(平均值、中位数等)。从阅读本文开始,而不仅仅是浏览Javadoc。
  • LinearTransformation 表示 y = mx + b的两个值之间的线性变换; 例如,英尺和米之间的换算,或者凯尔文和摄氏温度之间的换算。

示例:

int logFloor = LongMath.log2(n, FLOOR);

int mustNotOverflow = IntMath.checkedMultiply(x, y);

long quotient = LongMath.divide(knownMultipleOfThree, 3, RoundingMode.UNNECESSARY); // fail fast on non-multiple of 3

BigInteger nearestInteger = DoubleMath.roundToBigInteger(d, RoundingMode.HALF_EVEN);

BigInteger sideLength = BigIntegerMath.sqrt(area, CEILING);

- 阅读剩余部分 -