...

Package precision

Overview ▾

Constants

const (
    // DefaultFloatingPrecision is the default floating point precision used for rounding.
    // The difference in floating numbers precision has caused file inconsistencies between arm64 and amd64 architectures.
    // This default values is based a recommendation given on page 2 of the Developing with PDF book authored by Leonard Rosenthol.
    DefaultPrecision = 4
)

func RoundDefault

func RoundDefault(value float64) float64

RoundDefault rounds a float64 to the number of decimal places defined in DefaultPrecision.

func RoundFloat

func RoundFloat(value float64, precision int) float64

RoundFloat rounds a float64 to the specified number of decimal places