Skip to content

Union() -> Union{} #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
language: cpp
compiler:
- clang
language: julia
os:
- linux
- osx
julia:
- 0.3
- 0.4
- nightly
notifications:
email: false
env:
matrix:
- JULIAVERSION="juliareleases"
- JULIAVERSION="julianightlies"
before_install:
- sudo add-apt-repository ppa:staticfloat/julia-deps -y
- sudo add-apt-repository ppa:staticfloat/${JULIAVERSION} -y
- sudo apt-get update -qq -y
- sudo apt-get install libpcre3-dev julia -y
script:
- julia -e 'Pkg.init(); run(`ln -s $(pwd()) $(Pkg.dir("FixedPointNumbers"))`); Pkg.pin("FixedPointNumbers"); Pkg.resolve()'
- julia test/runtests.jl
4 changes: 2 additions & 2 deletions src/FixedPointNumbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ end
# Particularly useful for arrays.
scaledual(Tdual::Type, x) = one(Tdual), x
scaledual{Tdual<:Number}(b::Tdual, x) = b, x
scaledual{T<:FixedPoint}(Tdual::Type, x::Union(T, AbstractArray{T})) =
@compat scaledual{T<:FixedPoint}(Tdual::Type, x::Union{T,AbstractArray{T}}) =
convert(Tdual, 1/one(T)), reinterpret(rawtype(T), x)
scaledual{Tdual<:Number, T<:FixedPoint}(b::Tdual, x::Union(T, AbstractArray{T})) =
@compat scaledual{Tdual<:Number, T<:FixedPoint}(b::Tdual, x::Union{T,AbstractArray{T}}) =
convert(Tdual, b/one(T)), reinterpret(rawtype(T), x)

end # module
6 changes: 4 additions & 2 deletions test/fixed32.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function test_fixed{T}(::Type{T}, f)
tol = 2.0^-f

for x in values
#isinteger(x) && @show x
isinteger(x) && @show x
fx = convert(T,x)
@test convert(T,convert(Float64, fx)) == fx
@test convert(T,convert(Float64, -fx)) == -fx
Expand Down Expand Up @@ -45,5 +45,7 @@ function test_fixed{T}(::Type{T}, f)
end

for f in [8, 10, 16]
test_fixed(Fixed32{f}, f)
T = Fixed32{f}
println(" Testing $T")
test_fixed(T, f)
end
6 changes: 4 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
include("fixed32.jl")
include("ufixed.jl")
for f in ["ufixed.jl", "fixed32.jl"]
println("Testing $f")
include(f)
end