Is it reasonable to expect tan(蟺/2) == Inf to be true? Similarly, should tan(蟺) == 0 be true?
Also, not to labour the point, but I noticed that cot(蟺) threw a MethodError.
julia> versioninfo()
Julia Version 1.0.0
Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = "C:\XXXX\atom\app-1.29.0\atom.exe" -a
JULIA_NUM_THREADS = 4
On the other hand, the functions sinpi and cospi work as you would expect.
julia> sinpi(0.5)/cospi(0.5) == Inf
true
julia> sinpi(1.0)/cospi(1.0) == 0.0
true
Unfortunately there is no tanpi yet.
You made a good point. cot(蟺) will call one(Irrational{:蟺}) / tan(蟺). However, one(Irrational{:蟺}) is not defined. Same situation for csc and sec. It seems that the conversion of type Irrational is not perfect at this moment.
See also #7994 and #5561.
Can we define a tanpi(x) method as sinpi(x)/cospi(x)?
And similarly for cotpi, cscpi, secpi?
Is it good practice to replace tangent and cotangent with sine-cosine ratios?
I stumbled on the fact that in Julia there is no this function (cotpi and tanpi), and in numpy (as another example) there is no cotangent at all, so I would like to know what can be done?
(sorry for bad English)
Defining accurate versions of all of these trig functions for multiples of pi seems like the right way.
Most helpful comment
Defining accurate versions of all of these trig functions for multiples of pi seems like the right way.