Java math and money
Calculate a change in temperature, pack boxes, or round a bill.
Everyday arithmetic and rounding
- Math.absMeasure a temperature change
- Math.ceilBook enough tables for every guest
- Math.floorCount full bags of rice
- Math.min and Math.maxLimit a voucher to the amount due
- BigDecimal.setScaleRound a price to cents
- Math.roundDisplay a delivery estimate in whole minutes
- BigInteger.gcdPack two ribbon lengths into equal pieces
- Math.clampKeep a brightness setting inside the slider range
- Math.randomCheck the range of a random draw
- Math.rintRound a scale reading at an exact tie
- Math.signumShow the direction of a stock change
Powers, roots, and logarithms
- Math.cbrtMeasure a cube-shaped parcel
- Math.expCheck the baseline of a growth model
- Math.expm1Recover a small percentage increase
- Math.logMeasure the continuous growth needed to double
- Math.log10Count orders of magnitude in a reading
- Math.log1pConvert a small growth rate accurately
- Math.powProject repeated doubling
- Math.sqrtFind the side of a square garden
Angles and distances
- Math.acosRecover the angle of an awning arm
- Math.asinRecover a ladder angle from its height
- Math.atanTurn a ramp slope into an angle
- Math.atan2Find a direction on a map
- Math.cosFind the horizontal reach of an awning
- Math.coshEstimate the shape of a hanging cable
- Math.hypotMeasure the diagonal of a screen
- Math.sinFind the vertical share of a ladder
- Math.sinhEstimate the slope of a hanging cable
- Math.tanCalculate rise per metre of horizontal run
- Math.tanhSmooth a strong sensor signal
- Math.toDegreesLabel a quarter turn in degrees
- Math.toRadiansConvert a half turn into radians
Integer arithmetic and overflow
- Math.absExactMeasure a stock change and detect overflow
- Math.addExactAdd a shipment to the stock count
- Math.ceilDivCount crates for an order
- Math.ceilDivExactBook enough tables while checking division
- Math.ceilModMeasure the gap to the next full crate
- Math.decrementExactReserve one available place
- Math.divideExactDivide reward credits into whole shares
- Math.floorDivNumber time slots before opening
- Math.floorDivExactFind a time slot before a schedule starts
- Math.floorModWrap a shelf position back to the last shelf
- Math.incrementExactIssue the next numbered ticket
- Math.multiplyExactCount items in a shipment
- Math.multiplyFullCount cells in a large seating grid
- Math.multiplyHighKeep the high word of a large meter total
- Math.negateExactReverse an inventory adjustment
- Math.subtractExactSubtract completed sales from stock
- Math.toIntExactFit a batch count into an integer field
- Math.unsignedMultiplyHighDouble a device counter stored as unsigned bits
Floating-point precision
- Double.isFiniteReject unusable sensor readings
- Math.IEEEremainderFind a short signed turn
- Math.copySignApply a refund direction to an amount
- Math.fmaCombine a measured rate and a fixed fee
- Math.getExponentFind the binary scale of a sensor reading
- Math.nextAfterStep toward a calibration target
- Math.nextDownTest just below a measurement limit
- Math.nextUpTest just above a measurement limit
- Math.scalbUndo a power-of-two sensor scale
- Math.ulpInspect the resolution of a sensor calculation