From a3820d72da8d745e7abec16fd61ee64a54d6631b Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Fri, 6 Jul 2018 14:02:25 -0700 Subject: [PATCH 1/6] update for 0.7 --- .travis.yml | 1 + appveyor.yml | 39 ++++++++++++++++++--------------------- src/DecFP.jl | 14 +++++++++++++- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 73d41cf..f1ef9fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ os: julia: - 0.6 + - 0.7 - nightly notifications: diff --git a/appveyor.yml b/appveyor.yml index 88cf832..6154523 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,18 @@ environment: matrix: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" + - julia_version: 0.6 + - julia_version: 0.7 + - julia_version: latest + +platform: + - x86 + - x64 + +## uncomment the following lines to allow failures on nightly julia +## (tests will run but not make your overall status red) +#matrix: +# allow_failures: +# - julia_version: latest branches: only: @@ -17,24 +26,12 @@ notifications: on_build_status_changed: false install: - - ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12" -# if there's a newer build queued for the same PR, cancel this one - - ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` - https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` - Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` - throw "There are newer queued builds for this pull request, failing early." } -# Download most recent Julia Windows binary - - ps: (new-object net.webclient).DownloadFile( - $env:JULIA_URL, - "C:\projects\julia-binary.exe") -# Run installer silently, output to C:\projects\julia - - C:\projects\julia-binary.exe /S /D=C:\projects\julia + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/master/bin/install.ps1')) build_script: -# Need to convert from shallow to complete for Pkg.clone to work - - IF EXIST .git\shallow (git fetch --unshallow) - - C:\projects\julia\bin\julia -e "versioninfo(); - Pkg.clone(pwd(), \"DecFP\"); Pkg.build(\"DecFP\")" + - echo "%JL_BUILD_SCRIPT%" + - julia -e "%JL_BUILD_SCRIPT%" test_script: - - C:\projects\julia\bin\julia -e "Pkg.test(\"DecFP\")" \ No newline at end of file + - echo "%JL_TEST_SCRIPT%" + - julia -e "%JL_TEST_SCRIPT%" diff --git a/src/DecFP.jl b/src/DecFP.jl index 4e2af70..e976448 100644 --- a/src/DecFP.jl +++ b/src/DecFP.jl @@ -20,6 +20,10 @@ using Compat, Compat.Printf, Compat.Unicode export GC end +@static if VERSION >= v"0.7.0-alpha.69" + import SpecialFunctions +end + export Dec32, Dec64, Dec128, @d_str, @d32_str, @d64_str, @d128_str, exponent10, ldexp10 # Load libbid from our deps.jl @@ -372,7 +376,7 @@ for w in (32,64,128) @eval Base.$f(x::$BID, y::$BID) = nox(ccall(($(bidsym(w,c)), libbid), $BID, ($BID,$BID), x, y)) end - for f in (:exp,:log,:sin,:cos,:tan,:asin,:acos,:atan,:sinh,:cosh,:tanh,:asinh,:acosh,:atanh,:log1p,:expm1,:log10,:log2,:exp2,:exp10,:lgamma,:sqrt,:cbrt,:abs) + for f in (:exp,:log,:sin,:cos,:tan,:asin,:acos,:atan,:sinh,:cosh,:tanh,:asinh,:acosh,:atanh,:log1p,:expm1,:log10,:log2,:exp2,:exp10,:sqrt,:cbrt,:abs) @eval Base.$f(x::$BID) = @xchk(ccall(($(bidsym(w,f)), libbid), $BID, ($BID,), x), DomainError, x, mask=INVALID) end @@ -380,6 +384,14 @@ for w in (32,64,128) @eval Base.$f(x::$BID) = @xchk(ccall(($(bidsym(w,c)), libbid), $BID, ($BID,), x), DomainError, x, mask=INVALID) end + @static if VERSION >= v"0.7.0-alpha.69" + @eval SpecialFunctions.lgamma(x::$BID) = @xchk(ccall(($(bidsym(w,:lgamma)), libbid), $BID, ($BID,), x), DomainError, x, mask=INVALID) + @eval SpecialFunctions.gamma(x::$BID) = @xchk(ccall(($(bidsym(w,:tgamma)), libbid), $BID, ($BID,), x), DomainError, x, mask=INVALID) + else + @eval Base.lgamma(x::$BID) = @xchk(ccall(($(bidsym(w,:lgamma)), libbid), $BID, ($BID,), x), DomainError, x, mask=INVALID) + @eval Base.gamma(x::$BID) = @xchk(ccall(($(bidsym(w,:tgamma)), libbid), $BID, ($BID,), x), DomainError, x, mask=INVALID) + end + for (r,c) in ((RoundingMode{:Nearest},"round_integral_nearest_even"), (RoundingMode{:NearestTiesAway},"round_integral_nearest_away"), (RoundingMode{:ToZero},"round_integral_zero"), (RoundingMode{:Up},"round_integral_positive"), (RoundingMode{:Down},"round_integral_negative")) @eval Base.round(x::$BID, ::$r) = @xchk(ccall(($(bidsym(w,c)), libbid), $BID, ($BID,), x), DomainError, x, mask=INVALID) end From eae63f1bc5f8c4f15a0766ebff7994147ce4294f Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Fri, 6 Jul 2018 14:20:39 -0700 Subject: [PATCH 2/6] update REQUIRE --- REQUIRE | 1 + 1 file changed, 1 insertion(+) diff --git a/REQUIRE b/REQUIRE index 1bf8c91..1747b6a 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,4 @@ julia 0.6 Compat 0.61.0 BinaryProvider +SpecialFunctions From cd8a66ca9324f01d57e6fffe7d95fa42177666d0 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Fri, 6 Jul 2018 14:27:52 -0700 Subject: [PATCH 3/6] missed one --- src/DecFP.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DecFP.jl b/src/DecFP.jl index e976448..eb3a3ce 100644 --- a/src/DecFP.jl +++ b/src/DecFP.jl @@ -380,7 +380,7 @@ for w in (32,64,128) @eval Base.$f(x::$BID) = @xchk(ccall(($(bidsym(w,f)), libbid), $BID, ($BID,), x), DomainError, x, mask=INVALID) end - for (f,c) in ((:gamma,"tgamma"), (:-,"negate"), (:trunc,"round_integral_zero"), (:floor,"round_integral_negative"), (:ceil,"round_integral_positive"), (:round,"nearbyint")) + for (f,c) in ((:-,"negate"), (:trunc,"round_integral_zero"), (:floor,"round_integral_negative"), (:ceil,"round_integral_positive"), (:round,"nearbyint")) @eval Base.$f(x::$BID) = @xchk(ccall(($(bidsym(w,c)), libbid), $BID, ($BID,), x), DomainError, x, mask=INVALID) end From 6be4feb0bcc150a02156c85a6403e4dd6a337521 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Fri, 6 Jul 2018 14:56:23 -0700 Subject: [PATCH 4/6] more missing bits --- src/DecFP.jl | 2 +- test/runtests.jl | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/DecFP.jl b/src/DecFP.jl index eb3a3ce..bcc1bd4 100644 --- a/src/DecFP.jl +++ b/src/DecFP.jl @@ -372,7 +372,7 @@ for w in (32,64,128) @eval Base.$f(x::$BID) = ccall(($(bidsym(w,c)), libbid), Cint, ($BID,), x) != 0 end - for (f,c) in ((:+,"add"), (:-,"sub"), (:*,"mul"), (:/, "div"), (:hypot,"hypot"), (:atan2,"atan2"), (:^,"pow"), (:copysign,"copySign")) + for (f,c) in ((:+,"add"), (:-,"sub"), (:*,"mul"), (:/, "div"), (:hypot,"hypot"), (VERSION >= v"0.7.0-alpha+44" ? :atan : :atan2,"atan2"), (:^,"pow"), (:copysign,"copySign")) @eval Base.$f(x::$BID, y::$BID) = nox(ccall(($(bidsym(w,c)), libbid), $BID, ($BID,$BID), x, y)) end diff --git a/test/runtests.jl b/test/runtests.jl index a107c42..26aef0b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,6 +4,11 @@ if !(VERSION < v"0.7.0-DEV.1592") using Base.MathConstants end +if VERSION >= v"0.7.0-alpha.69" + using SpecialFunctions +end + + @test unsafe_load(DecFP.flags[]) == 0 import DecFP.isnanstr @@ -130,7 +135,7 @@ for T in (Dec32, Dec64, Dec128) @test f(xd,yd) == f(x,y) end - for f in (/,hypot,atan2,^) + for f in (/,hypot,VERSION >= v"0.7.0-alpha+44"?atan2:atan,^) @test f(xd,yd) ≈ f(x,y) if f != ^ @test f(yd,xd) ≈ f(y,x) From ecae65dc2206d63694c214d5e28609127684af75 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Fri, 6 Jul 2018 15:19:11 -0700 Subject: [PATCH 5/6] and more... --- src/DecFP.jl | 2 +- test/runtests.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DecFP.jl b/src/DecFP.jl index bcc1bd4..3a461dc 100644 --- a/src/DecFP.jl +++ b/src/DecFP.jl @@ -372,7 +372,7 @@ for w in (32,64,128) @eval Base.$f(x::$BID) = ccall(($(bidsym(w,c)), libbid), Cint, ($BID,), x) != 0 end - for (f,c) in ((:+,"add"), (:-,"sub"), (:*,"mul"), (:/, "div"), (:hypot,"hypot"), (VERSION >= v"0.7.0-alpha+44" ? :atan : :atan2,"atan2"), (:^,"pow"), (:copysign,"copySign")) + for (f,c) in ((:+,"add"), (:-,"sub"), (:*,"mul"), (:/, "div"), (:hypot,"hypot"), (VERSION >= v"0.7.0-alpha.44" ? :atan : :atan2,"atan2"), (:^,"pow"), (:copysign,"copySign")) @eval Base.$f(x::$BID, y::$BID) = nox(ccall(($(bidsym(w,c)), libbid), $BID, ($BID,$BID), x, y)) end diff --git a/test/runtests.jl b/test/runtests.jl index 26aef0b..43193a3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -135,7 +135,7 @@ for T in (Dec32, Dec64, Dec128) @test f(xd,yd) == f(x,y) end - for f in (/,hypot,VERSION >= v"0.7.0-alpha+44"?atan2:atan,^) + for f in (/,hypot,VERSION>=v"0.7.0-alpha.44"?atan:atan2,^) @test f(xd,yd) ≈ f(x,y) if f != ^ @test f(yd,xd) ≈ f(y,x) From bea1b0f431d2d6f23b1e20ce6120602197279ac9 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Fri, 6 Jul 2018 15:34:06 -0700 Subject: [PATCH 6/6] Compat will deal with atan2 in tests --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 43193a3..dfd6a60 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -135,7 +135,7 @@ for T in (Dec32, Dec64, Dec128) @test f(xd,yd) == f(x,y) end - for f in (/,hypot,VERSION>=v"0.7.0-alpha.44"?atan:atan2,^) + for f in (/,hypot,atan,^) @test f(xd,yd) ≈ f(x,y) if f != ^ @test f(yd,xd) ≈ f(y,x)