Skip to content

Package denary64 provides base-10 floating point numbers, which are safe to use to store money values, and are safe to do math calculations with; as opposed to the built-in Golang types float32, and float64 which are base-2 floating point number types (rather than base-10) and which are NOT safe to use for money.

Notifications You must be signed in to change notification settings

reiver/go-denary64

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-denary64

Package denary64 provides a base-10 floating point number type, for the Go programming language.

Base-10 floating point numbers are safe to use to store money values, and are safe to do math calculations with on money values.

This is as opposed to the built-in Golang types float32, and float64 which are base-2 floating point number types (rather than base-10) and which are NOT safe to use for money values.

Documentation

Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-denary64

GoDoc

Example

import "github.com/reiver/go-denary64"

x := denary64.Parse("12000.42")
y := denary64.Parse("7.00")

z := x.Add(y)

fmt.Printf("x + y = z", x, y, z)
// Output: 12000.42 + 7 = 12007.42

About

Package denary64 provides base-10 floating point numbers, which are safe to use to store money values, and are safe to do math calculations with; as opposed to the built-in Golang types float32, and float64 which are base-2 floating point number types (rather than base-10) and which are NOT safe to use for money.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages