-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
- v0.2.3 | ||
- Dimensionful quantities are no longer accepted for `floor`, `ceil`, `trunc`, `round`, | ||
`isinteger`. The choice of units can yield physically different results. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ajkeller34
Author
Collaborator
|
||
The functions are defined for dimensionless quantities, and return unitless numbers. | ||
Closes [#78](https://github.com/ajkeller34/Unitful.jl/issues/78). | ||
- Added `gn`, a constant quantity for the gravitational acceleration on earth | ||
[#75](https://github.com/ajkeller34/Unitful.jl/pull/75). | ||
- Added `ge`, the gravitational acceleration on earth as a unit | ||
[#75](https://github.com/ajkeller34/Unitful.jl/pull/75). | ||
- Added `lbf`, pounds-force unit | ||
[#75](https://github.com/ajkeller34/Unitful.jl/pull/75). | ||
- v0.2.2 | ||
- Fixed a bug in promotion involving `ContextUnits` where the promotion context might | ||
not be properly retained. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -520,8 +520,9 @@ end | |
@test inv([1 1; -1 1]u"nm") ≈ [0.5 -0.5; 0.5 0.5]u"nm^-1" | ||
end | ||
@testset "> Is functions" begin | ||
@test isinteger(1.0m) | ||
@test !isinteger(1.4m) | ||
@test_throws ErrorException isinteger(1.0m) | ||
@test isinteger(1.4m/mm) | ||
@test !isinteger(1.4mm/m) | ||
@test isfinite(1.0m) | ||
@test !isfinite(Inf*m) | ||
@test isnan(NaN*m) | ||
|
@@ -771,14 +772,14 @@ end | |
end | ||
|
||
@testset "Rounding" begin | ||
@test @inferred(trunc(3.7m)) == 3.0m | ||
@test trunc(-3.7m) == -3.0m | ||
@test @inferred(floor(3.7m)) == 3.0m | ||
@test floor(-3.7m) == -4.0m | ||
@test @inferred(ceil(3.7m)) == 4.0m | ||
@test ceil(-3.7m) == -3.0m | ||
@test @inferred(round(3.7m)) == 4.0m | ||
@test round(-3.7m) == -4.0m | ||
@test_throws ErrorException floor(3.7m) | ||
@test_throws ErrorException ceil(3.7m) | ||
@test_throws ErrorException trunc(3.7m) | ||
@test_throws ErrorException round(3.7m) | ||
@test floor(1.0314m/mm) === 1031.0 | ||
@test ceil(1.0314m/mm) === 1032.0 | ||
@test trunc(-1.0314m/mm) === -1031.0 | ||
@test round(1.0314m/mm) === 1031.0 | ||
end | ||
|
||
@testset "Sgn, abs, &c." begin | ||
|
@@ -949,13 +950,8 @@ end | |
@test typeof(5m .* [1m, 2m, 3m]) == Array{typeof(1u"m^2"),1} | ||
@test @inferred(eye(2)*V) == [1.0V 0.0V; 0.0V 1.0V] | ||
@test @inferred(V*eye(2)) == [1.0V 0.0V; 0.0V 1.0V] | ||
@static if VERSION >= v"0.6.0-dev.1632" # Make dot ops fusing, PR 17623 | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ajkeller34
Author
Collaborator
|
||
@test_broken @inferred(eye(2).*V) == [1.0V 0.0V; 0.0V 1.0V] | ||
@test_broken @inferred(V.*eye(2)) == [1.0V 0.0V; 0.0V 1.0V] | ||
else | ||
@test @inferred(eye(2).*V) == [1.0V 0.0V; 0.0V 1.0V] | ||
@test @inferred(V.*eye(2)) == [1.0V 0.0V; 0.0V 1.0V] | ||
end | ||
@test @inferred(eye(2).*V) == [1.0V 0.0V; 0.0V 1.0V] | ||
@test @inferred(V.*eye(2)) == [1.0V 0.0V; 0.0V 1.0V] | ||
@test @inferred([1V 2V; 0V 3V].*2) == [2V 4V; 0V 6V] | ||
@test @inferred([1V, 2V] .* [true, false]) == [1V, 0V] | ||
@test @inferred([1.0m, 2.0m] ./ 3) == [1m/3, 2m/3] | ||
|
What is a user who only needs 3 significant figures out of
204.27mm
supposed to do?