Skip to content

Commit b7b7c8d

Browse files
authored
Deprecate factorial(::Measurement) (#111)
1 parent ba56443 commit b7b7c8d

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

NEWS.md

+8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
([#103](https://github.com/JuliaPhysics/Measurements.jl/issues/103),
99
[#104](https://github.com/JuliaPhysics/Measurements.jl/pull/104)).
1010

11+
### Deprecations
12+
13+
* `factorial(a::Measurement)` is deprecated in favour of
14+
`SpecialFunctions.gamma(a + 1)`, as a result of
15+
`SpecialFunctions.factorial(a::AbstractFloat)` being removed in
16+
`SpecialFunctions.jl` v2.0
17+
([#111](https://github.com/JuliaPhysics/Measurements.jl/pull/111)).
18+
1119
## v2.6.0 (2021-04-20)
1220

1321
### New features

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Measurements"
22
uuid = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
33
authors = ["Mosè Giordano <[email protected]>"]
4-
version = "2.6.0"
4+
version = "2.7.0"
55

66
[deps]
77
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"

src/special-functions.jl

+11-7
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,7 @@ function SpecialFunctions.dawson(a::Measurement{T}) where {T<:AbstractFloat}
6060
return result(res, one(T) - 2 * aval * res, a)
6161
end
6262

63-
# Factorial and gamma
64-
65-
function SpecialFunctions.factorial(a::Measurement)
66-
aval = a.val
67-
fact = SpecialFunctions.factorial(aval)
68-
return result(fact, fact*digamma(aval + one(aval)), a)
69-
end
63+
# Gamma
7064

7165
function SpecialFunctions.gamma(a::Measurement)
7266
aval = a.val
@@ -226,3 +220,13 @@ function SpecialFunctions.besselkx(nu::Real, a::Measurement)
226220
besselk(nu, x)*exp(x),
227221
a)
228222
end
223+
224+
# Deprecations
225+
function Base.factorial(a::Measurement)
226+
Base.depwarn("""
227+
factorial(($(a))::Measurement) is deprecated, instead use
228+
SpecialFunctions.gamma($(a + one(a)))
229+
""",
230+
:factorial)
231+
SpecialFunctions.gamma(a + one(a))
232+
end

0 commit comments

Comments
 (0)