-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathfrequency.go
135 lines (112 loc) · 3.27 KB
/
frequency.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package unit
// Frequency represents a SI unit of frequency (in hertz, Hz)
type Frequency Unit
// ...
const (
// SI
Yoctohertz = Hertz * 1e-24
Zeptohertz = Hertz * 1e-21
Attohertz = Hertz * 1e-18
Femtohertz = Hertz * 1e-15
Picohertz = Hertz * 1e-12
Nanohertz = Hertz * 1e-9
Microhertz = Hertz * 1e-6
Millihertz = Hertz * 1e-3
Centihertz = Hertz * 1e-2
Decihertz = Hertz * 1e-1
Hertz Frequency = 1e0
Decahertz = Hertz * 1e1
Hectohertz = Hertz * 1e2
Kilohertz = Hertz * 1e3
Megahertz = Hertz * 1e6
Gigahertz = Hertz * 1e9
Terahertz = Hertz * 1e12
Petahertz = Hertz * 1e15
Exahertz = Hertz * 1e18
Zettahertz = Hertz * 1e21
Yottahertz = Hertz * 1e24
)
// Yoctohertz returns the frequency in yHz
func (f Frequency) Yoctohertz() float64 {
return float64(f / Yoctohertz)
}
// Zeptohertz returns the frequency in zHz
func (f Frequency) Zeptohertz() float64 {
return float64(f / Zeptohertz)
}
// Attohertz returns the frequency in aHz
func (f Frequency) Attohertz() float64 {
return float64(f / Attohertz)
}
// Femtohertz returns the frequency in fHz
func (f Frequency) Femtohertz() float64 {
return float64(f / Femtohertz)
}
// Picohertz returns the frequency in pHz
func (f Frequency) Picohertz() float64 {
return float64(f / Picohertz)
}
// Nanohertz returns the frequency in nHz
func (f Frequency) Nanohertz() float64 {
return float64(f / Nanohertz)
}
// Microhertz returns the frequency in µHz
func (f Frequency) Microhertz() float64 {
return float64(f / Microhertz)
}
// Millihertz returns the frequency in mHz
func (f Frequency) Millihertz() float64 {
return float64(f / Millihertz)
}
// Centihertz returns the frequency in cHz
func (f Frequency) Centihertz() float64 {
return float64(f / Centihertz)
}
// Decihertz returns the frequency in dHz
func (f Frequency) Decihertz() float64 {
return float64(f / Decihertz)
}
// Hertz returns the frequency in Hz
func (f Frequency) Hertz() float64 {
return float64(f)
}
// Decahertz returns the frequency in daHz
func (f Frequency) Decahertz() float64 {
return float64(f / Decahertz)
}
// Hectohertz returns the frequency in hHz
func (f Frequency) Hectohertz() float64 {
return float64(f / Hectohertz)
}
// Kilohertz returns the frequency in kHz
func (f Frequency) Kilohertz() float64 {
return float64(f / Kilohertz)
}
// Megahertz returns the frequency in MHz
func (f Frequency) Megahertz() float64 {
return float64(f / Megahertz)
}
// Gigahertz returns the frequency in GHz
func (f Frequency) Gigahertz() float64 {
return float64(f / Gigahertz)
}
// Terahertz returns the frequency in THz
func (f Frequency) Terahertz() float64 {
return float64(f / Terahertz)
}
// Petahertz returns the frequency in PHz
func (f Frequency) Petahertz() float64 {
return float64(f / Petahertz)
}
// Exahertz returns the frequency in EHz
func (f Frequency) Exahertz() float64 {
return float64(f / Exahertz)
}
// Zettahertz returns the frequency in ZHz
func (f Frequency) Zettahertz() float64 {
return float64(f / Zettahertz)
}
// Yottahertz returns the frequency in YHz
func (f Frequency) Yottahertz() float64 {
return float64(f / Yottahertz)
}