You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Length converts a length value from one unit to another.
134
120
121
+
\*\*Warning:\*\* Due to the nature of floating point arithmetic, the result may not be exact for some conversions. Do not use this package for rocket science.
135
122
123
+
<a name="LengthUnit"></a>
124
+
## type [LengthUnit](<https://github.com/atomicgo/convert/blob/main/length.go#L3>)
136
125
137
126
138
127
139
128
```go
140
-
package main
141
-
142
-
import (
143
-
"fmt"
144
-
145
-
"atomicgo.dev/template"
146
-
)
147
-
148
-
func main() {
149
-
fmt.Println(template.HelloWorld())
150
-
}
129
+
type LengthUnit float64
151
130
```
152
131
153
-
#### Output
132
+
<a name="Nanometer"></a>
154
133
134
+
```go
135
+
const (
136
+
// Metric system
137
+
Nanometer LengthUnit = 9.999999999e-10 // Nanometer to meter conversion
138
+
Micrometer LengthUnit = 0.000001 // Micrometer to meter conversion
139
+
Millimeter LengthUnit = 0.001 // Millimeter to meter conversion
140
+
Centimeter LengthUnit = 0.01 // Centimeter to meter conversion
141
+
Decimeter LengthUnit = 0.1 // Decimeter to meter conversion
142
+
Meter LengthUnit = 1 // Meter is the base unit
143
+
Decameter LengthUnit = 10 // Decameter to meter conversion
144
+
Hectometer LengthUnit = 100 // Hectometer to meter conversion
145
+
Kilometer LengthUnit = 1000 // Kilometer to meter conversion
146
+
Megameter LengthUnit = 1000000 // Megameter to meter conversion
147
+
Gigameter LengthUnit = 1000000000 // Gigameter to meter conversion
148
+
Terameter LengthUnit = 1000000000000 // Terameter to meter conversion
149
+
Petameter LengthUnit = 1000000000000000 // Petameter to meter conversion
150
+
Exameter LengthUnit = 1000000000000000000 // Exameter to meter
151
+
Micron LengthUnit = 0.000001 // Micron to meter conversion
152
+
Picometer LengthUnit = 1e-12 // Picometer to meter conversion
153
+
Femtometer LengthUnit = 9.999999999e-16 // Femtometer to meter conversion
154
+
Attometer LengthUnit = 1e-18 // Attometer to meter conversion
155
+
156
+
// Imperial system
157
+
Thou LengthUnit = 2.54e-5 // Thou (mil) to meter conversion
158
+
Inch LengthUnit = 0.0254 // Inch to meter conversion
159
+
Foot LengthUnit = 0.3048 // Foot to meter conversion
160
+
Yard LengthUnit = 0.9144 // Yard to meter conversion
161
+
Chain LengthUnit = 20.1168 // Chain to meter conversion (66 feet)
162
+
Rope LengthUnit = 6.096 // Rope to meter conversion (20 feet)
163
+
Furlong LengthUnit = 201.168 // Furlong to meter conversion (1/8th of a mile)
164
+
Mile LengthUnit = 1609.344 // Mile to meter conversion
165
+
League LengthUnit = 4828.032 // League to meter conversion (3 miles)
166
+
NauticalMile LengthUnit = 1852 // Nautical Mile to meter conversion (international)
167
+
168
+
// Astronomical units
169
+
AstronomicalUnit LengthUnit = 149597870691 // Astronomical Unit (AU) to meter conversion
170
+
LightYear LengthUnit = 9460730472580044 // Light-year to meter conversion
171
+
Parsec LengthUnit = 30856775812799588 // Parsec to meter conversion
172
+
Megaparsec LengthUnit = 3.085677581e+22 // Megaparsec to meter
173
+
Kiloparsec LengthUnit = 30856775812799586000 // Kiloparsec to meter
174
+
PlanckLength LengthUnit = 1.616049999e-35 // Planck length to meter conversion
175
+
176
+
// Other units
177
+
Angstrom LengthUnit = 9.999999999e-11 // Angstrom to meter conversion
178
+
Fathom LengthUnit = 1.8288 // Fathom to meter conversion (6 feet)
179
+
Rod LengthUnit = 5.0292 // Rod to meter conversion (16.5 feet)
180
+
SurveyFoot LengthUnit = 0.3048006096 // Survey foot to meter conversion (used in land surveys)
181
+
Pica LengthUnit = 0.0042333333 // Pica to meter conversion (commonly used in typography)
182
+
Point LengthUnit = 0.0003527778 // Point to meter conversion (1/12th of a pica)
183
+
Hand LengthUnit = 0.1016 // Hand to meter conversion (used in measuring the height of horses)
184
+
)
155
185
```
156
-
Hello, World!
157
-
```
158
-
159
-
160
186
161
187
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
0 commit comments