Go math and money
Calculate a change in temperature, pack boxes, or round a bill.
Everyday arithmetic and rounding
- math.AbsIn Go, math.Abs returns the magnitude of a number.
- math.CeilIn Go, math.Ceil rounds toward positive infinity.
- math.FloorIn Go, math.Floor rounds toward negative infinity.
- math.MaxKeep enough seats for a booking
- math.MinCap a voucher at the total due
- math.RoundDisplay a delivery estimate in minutes
- math.RoundToEvenRound a scale reading at an exact tie
- rand.Float64Check 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.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.HypotMeasure diagonal travel without squaring 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.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
Floating-point precision
- math.CopysignApply a refund direction to an amount
- math.FMACombine a measured rate and a fixed fee
- math.IsInf and IsNaNReject unusable sensor readings
- math.LdexpUndo a power-of-two sensor scale
- math.NextafterTest just below a measurement limit
- math.NextafterTest just above a measurement limit
- math.RemainderFind a short signed turn