Skip to content

Commit 22e1fbd

Browse files
authored
copy rand_tangent(::BigFloat) from ChainRulesTestUtils (#155)
1 parent 93b6058 commit 22e1fbd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/rand_tangent.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ rand_tangent(rng::AbstractRNG, x::Integer) = DoesNotExist()
1313

1414
rand_tangent(rng::AbstractRNG, x::T) where {T<:Number} = randn(rng, T)
1515

16+
# TODO: right now Julia don't allow `randn(rng, BigFloat)`
17+
# see: https://github.com/JuliaLang/julia/issues/17629
18+
rand_tangent(rng::AbstractRNG, ::BigFloat) = big(randn(rng))
19+
1620
rand_tangent(rng::AbstractRNG, x::StridedArray) = rand_tangent.(Ref(rng), x)
1721

1822
function rand_tangent(rng::AbstractRNG, x::T) where {T<:Tuple}

test/rand_tangent.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ using FiniteDifferences: rand_tangent
1515
# Numbers.
1616
(5.0, Float64),
1717
(5.0 + 0.4im, Complex{Float64}),
18+
(big(5.0), BigFloat),
1819

1920
# StridedArrays.
2021
(randn(Float32, 3), Vector{Float32}),

0 commit comments

Comments
 (0)