Kotlin math and money
Calculate a change in temperature, pack boxes, or round a bill.
Everyday arithmetic and rounding
- Math.absIn Kotlin, Math.abs returns the magnitude of a number.
- Math.ceilIn Kotlin, Math.ceil rounds toward positive infinity.
- Math.floorIn Kotlin, Math.floor rounds toward negative infinity.
- coerceInClamp a requested brightness to its allowed range
- BigInteger.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
- kotlin.math.maxKeep enough seats for a booking
- kotlin.math.minCap a voucher at the total due
- kotlin.math.roundRound a scale reading at an exact tie
- kotlin.math.roundDisplay a delivery estimate in minutes
- kotlin.math.signShow the direction of a stock change
Powers, roots, and logarithms
- Double.powProject repeated doubling
- kotlin.math.cbrtMeasure a cube-shaped parcel
- kotlin.math.expCheck the baseline of a growth model
- kotlin.math.expm1Recover a small percentage increase
- kotlin.math.lnMeasure the continuous growth needed to double
- kotlin.math.ln1pConvert a small growth rate accurately
- kotlin.math.log10Count orders of magnitude in a reading
- kotlin.math.sqrtFind the side of a square garden
Angles and distances
- java.lang.Math.toDegreesLabel a quarter turn in degrees
- java.lang.Math.toRadiansConvert a half turn into radians
- kotlin.math.acosRecover the angle of an awning arm
- kotlin.math.asinRecover a ladder angle from its height
- kotlin.math.atanTurn a ramp slope into an angle
- kotlin.math.atan2Find a direction on a map
- kotlin.math.cosFind the horizontal reach of an awning
- kotlin.math.coshEstimate the shape of a hanging cable
- kotlin.math.hypotMeasure the diagonal of a screen
- kotlin.math.sinFind the vertical share of a ladder
- kotlin.math.sinhEstimate the slope of a hanging cable
- kotlin.math.tanCalculate rise per metre of horizontal run
- kotlin.math.tanhSmooth a strong sensor signal
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.IEEEremainderFind a short signed turn
- java.lang.Math.copySignApply a refund direction to an amount
- 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