File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 754
754
@inline lgamma (x:: Real ) = lgamma (float (x))
755
755
756
756
# # from base/numbers.jl
757
- # TODO : deprecate instead of doing this type-piracy here?
758
- Base. factorial (x:: Number ) = gamma (x + 1 ) # fallback for x not Integer
757
+
758
+ # this trickery is needed while the deprecated method in Base exists
759
+ @static if ! hasmethod (Base. factorial, Tuple{Number})
760
+ import Base: factorial
761
+ end
762
+ factorial (x) = Base. factorial (x) # to make SpecialFunctions.factorial work unconditionally
763
+ factorial (x:: Number ) = gamma (x + 1 ) # fallback for x not Integer
759
764
760
765
else # @static if
761
766
Original file line number Diff line number Diff line change 576
576
@test lgamma (1.4 + 3.7im ) ≈ - 3.7094025330996841898 + 2.4568090502768651184im
577
577
@test lgamma (1.4 + 3.7im ) ≈ log (gamma (1.4 + 3.7im ))
578
578
@test lgamma (- 4.2 + 0im ) ≈ lgamma (- 4.2 )- 5pi * im
579
- @test factorial (3.0 ) == gamma (4.0 ) == factorial (3 )
579
+ @test SpecialFunctions . factorial (3.0 ) == gamma (4.0 ) == factorial (3 )
580
580
for x in (3.2 , 2 + 1im , 3 // 2 , 3.2 + 0.1im )
581
- @test factorial (x) == gamma (1 + x)
581
+ @test SpecialFunctions . factorial (x) == gamma (1 + x)
582
582
end
583
583
@test lfactorial (0 ) == lfactorial (1 ) == 0
584
584
@test lfactorial (2 ) == lgamma (3 )
You can’t perform that action at this time.
0 commit comments