Skip to content

Commit

Permalink
Doc updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkeller34 committed Mar 24, 2017
1 parent e7e67e9 commit 845a057
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/src/conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ julia> uconvert(Unitful.NoUnits, 1.0u"ΞΌm/m")
1.0e-6
julia> uconvert(Unitful.NoUnits, 1.0u"m")
ERROR: Unitful.DimensionError()
ERROR: DimensionError: and m are not dimensionally compatible.
```

You can also directly convert to a subtype of `Real` or `Complex`:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/extending.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ explicitly forbid any attempt to convert to SI units.
One can achieve this by defining new dimensions with the [`@dimension`](@ref) or
[`@derived_dimension`](@ref) macros. The trick is to define dimensions that display
suggestively like physical dimensions, like 𝐋*, 𝐓* etc., but are distinct as far
as Julia's type system is concerned. Then, you can use [`@ref_unit`](@ref) to
as Julia's type system is concerned. Then, you can use [`@refunit`](@ref) to
base units for these new dimensions without reference to SI. The result will be
that attempted conversion between the hypothetical unit system and SI will fail
with a `DimensionError`, so be sure you provide some hints in how your
Expand Down
7 changes: 3 additions & 4 deletions docs/src/trouble.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ Variables:
Body:
begin
p::Int64 = 2
return $(Expr(:invoke, MethodInstance for ^(::Quantity{Float64, Dimensions:{𝐋}, Units:{m}}, ::Int64), :(^), :(x), :(p)))
return $(Expr(:invoke, MethodInstance for ^(::Quantity{Float64, Dimensions:{𝐋}, Units:{m}}, ::Int64), :(^), :(x), 2))
end::Any
```

Expand All @@ -64,11 +63,11 @@ Variables:
Body:
begin
$(Expr(:inbounds, false))
# meta: location /Users/ajkeller/.julia/v0.6/Unitful/src/Unitful.jl ^ 1044
# meta: location /Users/ajkeller/.julia/v0.6/Unitful/src/Unitful.jl literal_pow 1058
SSAValue(0) = (Core.getfield)(x::Quantity{Float64, Dimensions:{𝐋}, Units:{m}}, :val)::Float64
# meta: pop location
$(Expr(:inbounds, :pop))
return $(Expr(:new, :($(QuoteNode(Quantity{Float64, Dimensions:{𝐋^2}, Units:{m^2}}))), :((Base.mul_float)(SSAValue(0), SSAValue(0))::Float64)))
return $(Expr(:new, Quantity{Float64, Dimensions:{𝐋^2}, Units:{m^2}}, :((Base.mul_float)(SSAValue(0), SSAValue(0))::Float64)))
end::Quantity{Float64, Dimensions:{𝐋^2}, Units:{m^2}}
```

Expand Down
2 changes: 1 addition & 1 deletion src/Unitful.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ julia> unit(1.0u"m") == u"m"
true
julia> typeof(u"m")
Unitful.Units{(Unitful.Unit{:Meter,Unitful.Dimensions{(Unitful.Dimension{:Length}(1//1),)}}(0,1//1),),Unitful.Dimensions{(Unitful.Dimension{:Length}(1//1),)}}
Unitful.Units{(Unitful.Unit{:Meter,Unitful.Dimensions{(Unitful.Dimension{:Length}(1//1),)}}(0, 1//1),),Unitful.Dimensions{(Unitful.Dimension{:Length}(1//1),)}}
```
"""
@inline unit{T,D,U}(x::Quantity{T,D,U}) = U()
Expand Down
2 changes: 1 addition & 1 deletion src/User.jl
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ julia> 1.0u"N*m"
1.0 m N
julia> u"m,kg,s"
(m,kg,s)
(m, kg, s)
julia> typeof(1.0u"m/s")
Quantity{Float64, Dimensions:{𝐋 𝐓^-1}, Units:{m s^-1}}
Expand Down

0 comments on commit 845a057

Please sign in to comment.