File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -163,12 +163,25 @@ julia> ulength(x)
163163```
164164
165165Finally, you can strip units with ` ustrip ` :
166-
166+
167167``` julia
168168julia> ustrip (x)
1691690.2
170170```
171171
172+ You can also convert a quantity to a desired unit and * then* strip the units
173+ using a two-argument version of ` ustrip ` :
174+
175+ ``` julia
176+ julia> ustrip (u " km" , 1000 u " m" )
177+ 1.0
178+
179+ julia> ustrip (u " minute" , 60 u " s" )
180+ 1.0
181+ ```
182+
183+ This is equivalent to ` ustrip(quantity / unit) ` but performs dimension checks first.
184+
172185### Constants
173186
174187There are a variety of physical constants accessible
@@ -298,6 +311,16 @@ julia> freezing = 32ua"degF"
298311273.15 K
299312```
300313
314+ These are regular ` Quantity{Float64,Dimensions{...}} ` objects, meaning that you
315+ can use them in the same way as regular quantities, including taking differences.
316+
317+ To convert back, you can use the two-argument ` ustrip ` with the particular affine unit:
318+
319+ ``` julia
320+ julia> ustrip (ua " degC" , 295.15 u " K" )
321+ 22.0
322+ ```
323+
301324### Arrays
302325
303326For working with an array of quantities that have the same dimensions,
@@ -439,3 +462,4 @@ julia> @btime f($q8);
439462julia> @btime f ($ q32);
440463 1.883 μs (4 allocations: 39.12 KiB)
441464```
465+
You can’t perform that action at this time.
0 commit comments