@@ -16,15 +16,18 @@ rand_tangent(rng::AbstractRNG, x::Integer) = NoTangent()
16
16
# Try and make nice numbers with short decimal representations for good error messages
17
17
# while also not biasing the sample space too much
18
18
function rand_tangent (rng:: AbstractRNG , x:: T ) where {T<: Number }
19
- return round (8 randn (rng, T), sigdigits= 5 , base= 2 )
19
+ # multiply by 9 to give a bigger range of values tested: no so tightly clustered around 0.
20
+ return round (9 * randn (rng, T), sigdigits= 5 , base= 2 )
20
21
end
21
22
rand_tangent (rng:: AbstractRNG , x:: Float64 ) = rand (rng, - 9 : 0.01 : 9 )
22
23
function rand_tangent (rng:: AbstractRNG , x:: ComplexF64 )
23
24
return ComplexF64 (rand (rng, - 9 : 0.1 : 9 ), rand (rng, - 9 : 0.1 : 9 ))
24
25
end
25
26
26
27
# BigFloat/MPFR is finicky about short numbers, this doesn't always work as well as it should
27
- rand_tangent (rng:: AbstractRNG , :: BigFloat ) = round (big (8 randn (rng)), sigdigits= 5 , base= 2 )
28
+
29
+ # multiply by 9 to give a bigger range of values tested: no so tightly clustered around 0.
30
+ rand_tangent (rng:: AbstractRNG , :: BigFloat ) = round (big (9 * randn (rng)), sigdigits= 5 , base= 2 )
28
31
29
32
rand_tangent (rng:: AbstractRNG , x:: StridedArray ) = rand_tangent .(Ref (rng), x)
30
33
rand_tangent (rng:: AbstractRNG , x:: Adjoint ) = adjoint (rand_tangent (rng, parent (x)))
0 commit comments