Ruby math and money
Calculate a change in temperature, pack boxes, or round a bill.
Everyday arithmetic and rounding
- number.absIn Ruby, number.abs returns the magnitude of a number.
- number.ceilIn Ruby, number.ceil rounds toward positive infinity.
- number.floorIn Ruby, number.floor rounds toward negative infinity.
- Integer#divmodSplit a signed balance into whole units and a remainder
- Array#maxKeep enough seats for a booking
- Array#minCap a voucher at the total due
- Comparable#clampKeep a brightness setting inside the slider range
- Float#roundDisplay a delivery estimate in minutes
- Integer#gcdPack two ribbon lengths into equal pieces
- Kernel#randCheck the range of a practice draw
Powers, roots, and logarithms
- Math.cbrtMeasure a cube-shaped parcel
- Math.expCheck the baseline of a growth model
- Math.logMeasure the continuous growth needed to double
- Math.log10Count orders of magnitude in a reading
- Math.sqrtFind the side of a square garden
- Numeric#**Project repeated doubling
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
Integer arithmetic and overflow
- Integer#divNumber time slots before opening
- Integer#moduloWrap a shelf position back to the last shelf