speter %!s(int64=13) %!d(string=hai) anos
pai
achega
89650ee71e
Modificáronse 4 ficheiros con 30 adicións e 23 borrados
  1. 2 2
      LICENSE
  2. 0 10
      README
  3. 28 9
      dec.go
  4. 0 2
      rounder.go

+ 2 - 2
LICENSE

@@ -1,4 +1,4 @@
-Copyright (c) 2012 Peter Suranyi. All rights reserved.
+Copyright (c) 2012 Péter Surányi. All rights reserved.
 
 
 Redistribution and use in source and binary forms, with or without
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
 modification, are permitted provided that the following conditions are
@@ -24,7 +24,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 ----------------------------------------------------------------------
 ----------------------------------------------------------------------
-Portions of godec's source code have been derived from Go, and are 
+Portions of inf.Dec's source code have been derived from Go and are
 covered by the following license:
 covered by the following license:
 ----------------------------------------------------------------------
 ----------------------------------------------------------------------
 
 

+ 0 - 10
README

@@ -1,10 +0,0 @@
-godec: multi-precision decimal arithmetic for go
-
-The API and the implementation are based on and complement those in the
-multi-precision integer (Int) implementation in the Go library (math/big).
-
-Limitations:
-Support for formatting options is currently missing.
-There is no support for potentially lossy conversions (e.g. float64 to Dec,
-Dec to int64, or Dec to float64) as the requirements for these usually differ
-depending on the use case.

+ 28 - 9
dec.go

@@ -1,7 +1,23 @@
-// Package dec implements multi-precision decimal arithmetic.
-// It supports the numeric type Dec for signed decimals.
-// It is based on and complements the multi-precision integer implementation
-// (Int) in the Go library (math/big).
+// Package inf (type inf.Dec) implements "infinite-precision" decimal
+// arithmetic.
+// "Infinite precision" describes two characteristics: practically unlimited
+// precision for decimal number representation and no support for calculating
+// with any specific fixed precision.
+// (Although there is no practical limit on precision, inf.Dec can only
+// represent finite decimals.)
+//
+// This package is currently in experimental stage and the API may change.
+//
+// This package does NOT support:
+//  - rounding to specific precisions (as opposed to specific decimal positions)
+//  - the notion of context (each rounding must be explicit)
+//  - NaN and Inf values, and distinguishing between positive and negative zero
+//  - conversions to and from float32/64 types
+//
+// Features considered for possible addition:
+//  + formatting options
+//  + Exp method
+//  + exchanging data in decimal32/64/128 formats
 //
 //
 // Methods are typically of the form:
 // Methods are typically of the form:
 //
 //
@@ -17,8 +33,6 @@
 //
 //
 package inf
 package inf
 
 
-// This file implements signed multi-precision decimals.
-
 import (
 import (
 	"fmt"
 	"fmt"
 	"io"
 	"io"
@@ -26,9 +40,14 @@ import (
 	"strings"
 	"strings"
 )
 )
 
 
-// A Dec represents a signed multi-precision decimal.
-// It is stored as a combination of a multi-precision big.Int unscaled value
-// and a fixed-precision scale of type Scale.
+// A Dec represents a signed arbitrary-precision decimal.
+// It is a combination of a sign, an arbitrary-precision integer coefficient
+// value, and a signed fixed-precision exponent value.
+// The sign and the coefficient value are handled together as a signed value
+// and referred to as the unscaled value.
+// (Positive and negative zero values are not distinguished.)
+// Since the exponent is most commonly negative, it is handled in negated form
+// and referred to as scale.
 //
 //
 // The mathematical value of a Dec equals:
 // The mathematical value of a Dec equals:
 //
 //

+ 0 - 2
rounder.go

@@ -1,7 +1,5 @@
 package inf
 package inf
 
 
-// This file implements signed multi-precision decimals.
-
 import (
 import (
 	"math/big"
 	"math/big"
 )
 )