-
Notifications
You must be signed in to change notification settings - Fork 1
/
float64.go
52 lines (41 loc) · 950 Bytes
/
float64.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
package nill
type Float64 Type[float64]
func NewFloat64(value float64) Float64 {
return Float64{Valid: true, V: value}
}
// Add adds value to Float32.
func (v *Float64) Add(value float64) {
v.V += value
}
// Sub subtracts value from Float32.
func (v *Float64) Sub(value float64) {
v.V -= value
}
// Mul multiplies Float32 by value.
func (v *Float64) Mul(value float64) {
v.V *= value
}
// Div divides Float32 by value.
func (v *Float64) Div(value float64) {
v.V /= value
}
// Inc calculates the remainder of Float32 divided by value.
func (v *Float64) Inc() {
v.V++
}
// Dec decrements Float32 by 1.
func (v *Float64) Dec() {
v.V--
}
// Zero returns true if Float32 is zero.
func (v *Float64) Zero() bool {
return v.V == 0
}
// Positive returns true if Float32 is positive.
func (v *Float64) Positive() bool {
return v.V > 0
}
// Negative returns true if Float32 is negative.
func (v *Float64) Negative() bool {
return v.V < 0
}