Scala math and money
Calculate a change in temperature, pack boxes, or round a bill.
Everyday arithmetic and rounding
- number.absIn Scala, number.abs returns the magnitude of a number.
- math.ceilCompute the number of pages for a batch
- math.floorAssign negative readings to intervals
- BigDecimal.setScaleRound exact invoice amounts at decimal ties
- BigInt.gcdPack two ribbon lengths into equal pieces
- java.lang.Math.clampKeep a brightness setting inside the slider range
- java.lang.Math.randomCheck the range of a random draw
- math.maxKeep enough seats for a booking
- math.minCap a voucher at the total due
- math.rintRound a scale reading at an exact tie
- math.roundDisplay a delivery estimate in minutes
- 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
- java.lang.Math.absExactMeasure a stock change and detect overflow
- java.lang.Math.addExactAdd a shipment to the stock count
- java.lang.Math.ceilDivCount crates for an order
- java.lang.Math.ceilDivExactBook enough tables while checking division
- java.lang.Math.ceilModMeasure the gap to the next full crate
- java.lang.Math.decrementExactReserve one available place
- java.lang.Math.divideExactDivide reward credits into whole shares
- java.lang.Math.floorDivNumber time slots before opening
- java.lang.Math.floorDivExactFind a time slot before a schedule starts
- java.lang.Math.floorModWrap a shelf position back to the last shelf
- java.lang.Math.incrementExactIssue the next numbered ticket
- java.lang.Math.multiplyExactCount items in a shipment
- java.lang.Math.multiplyFullCount cells in a large seating grid
- java.lang.Math.multiplyHighKeep the high word of a large meter total
- java.lang.Math.negateExactReverse an inventory adjustment
- java.lang.Math.subtractExactSubtract completed sales from stock
- java.lang.Math.toIntExactFit a batch count into an integer field
- java.lang.Math.unsignedMultiplyHighDouble a device counter stored as unsigned bits
Floating-point precision
- Double.isFiniteReject unusable sensor readings
- java.lang.Math.fmaCombine a measured rate and a fixed fee
- java.lang.Math.getExponentFind the binary scale of a sensor reading
- java.lang.Math.nextAfterStep toward a calibration target
- java.lang.Math.nextDownTest just below a measurement limit
- java.lang.Math.nextUpTest just above a measurement limit
- java.lang.Math.scalbUndo a power-of-two sensor scale
- java.lang.Math.ulpInspect the resolution of a sensor calculation
- math.IEEEremainderFind a short signed turn
- math.copySignApply a refund direction to an amount