forked from shopspring/decimal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default_functions.go
74 lines (56 loc) · 1.78 KB
/
default_functions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package decimal
import (
"math/big"
"regexp"
)
func New(value int64, exp int32) Decimal {
return DefaultOptions.New(value, exp)
}
func NewFromInt(value int64) Decimal {
return DefaultOptions.NewFromInt(value)
}
func NewFromInt32(value int32) Decimal {
return DefaultOptions.NewFromInt32(value)
}
func NewFromBigInt(value *big.Int, exp int32) Decimal {
return DefaultOptions.NewFromBigInt(value, exp)
}
func NewFromString(value string) (Decimal, error) {
return DefaultOptions.NewFromString(value)
}
func NewFromFormattedString(value string, replRegexp *regexp.Regexp) (Decimal, error) {
return DefaultOptions.NewFromFormattedString(value, replRegexp)
}
func RequireFromString(value string) Decimal {
return DefaultOptions.RequireFromString(value)
}
func NewFromFloat(value float64) Decimal {
return DefaultOptions.NewFromFloat(value)
}
func NewFromFloatSafe(value float64) (Decimal, error) {
return DefaultOptions.NewFromFloatSafe(value)
}
func NewFromFloat32(value float32) Decimal {
return DefaultOptions.NewFromFloat32(value)
}
func NewFromFloat32Safe(value float32) (Decimal, error) {
return DefaultOptions.NewFromFloat32Safe(value)
}
func NewFromFloatWithExponent(value float64, exp int32) Decimal {
return DefaultOptions.NewFromFloatWithExponent(value, exp)
}
func NewFromFloatWithExponentSafe(value float64, exp int32) (Decimal, error) {
return DefaultOptions.NewFromFloatWithExponentSafe(value, exp)
}
func Min(first Decimal, rest ...Decimal) Decimal {
return DefaultOptions.Min(first, rest...)
}
func Max(first Decimal, rest ...Decimal) Decimal {
return DefaultOptions.Max(first, rest...)
}
func Sum(first Decimal, rest ...Decimal) Decimal {
return DefaultOptions.Sum(first, rest...)
}
func Avg(first Decimal, rest ...Decimal) Decimal {
return DefaultOptions.Avg(first, rest...)
}