Documentation ¶
Index ¶
- Variables
- func AppendDecimalToFloat(dst []float64, va []int64, e int16) []float64
- func AppendFloatToDecimal(dst []int64, src []float64) ([]int64, int16)
- func CalibrateScale(a []int64, ae int16, b []int64, be int16) (e int16)
- func ExtendFloat64sCapacity(dst []float64, additionalItems int) []float64
- func ExtendInt64sCapacity(dst []int64, additionalItems int) []int64
- func FromFloat(f float64) (int64, int16)
- func IsStaleNaN(f float64) bool
- func RoundToDecimalDigits(f float64, digits int) float64
- func RoundToSignificantFigures(f float64, digits int) float64
- func ToFloat(v int64, e int16) float64
Constants ¶
This section is empty.
Variables ¶
var StaleNaN = math.Float64frombits(staleNaNBits)
StaleNaN is a special NaN value, which is used as Prometheus staleness mark. See https://www.robustperception.io/staleness-and-promql
Functions ¶
func AppendDecimalToFloat ¶
AppendDecimalToFloat converts each item in va to f=v*10^e, appends it to dst and returns the resulting dst.
func AppendFloatToDecimal ¶
AppendFloatToDecimal converts each item in src to v*10^e and appends each v to dst returning it as va.
It tries minimizing each item in dst.
func CalibrateScale ¶
CalibrateScale calibrates a and b with the corresponding exponents ae, be and returns the resulting exponent e.
func ExtendFloat64sCapacity ¶
ExtendFloat64sCapacity extends dst capacity to hold additionalItems and returns the extended dst.
func ExtendInt64sCapacity ¶
ExtendInt64sCapacity extends dst capacity to hold additionalItems and returns the extended dst.
func FromFloat ¶
FromFloat converts f to v*10^e.
It tries minimizing v. For instance, for f = -1.234 it returns v = -1234, e = -3.
FromFloat doesn't work properly with NaN values other than Prometheus staleness mark, so don't pass them here.
func IsStaleNaN ¶ added in v1.64.0
IsStaleNaN returns true if f represents Prometheus staleness mark.
func RoundToDecimalDigits ¶ added in v1.53.0
RoundToDecimalDigits rounds f to the given number of decimal digits after the point.
See also RoundToSignificantFigures.
func RoundToSignificantFigures ¶ added in v1.53.0
RoundToSignificantFigures rounds f to value with the given number of significant figures.
See also RoundToDecimalDigits.
Types ¶
This section is empty.