Skip to content

Commit

Permalink
Merge pull request JuliaLang#4121 from simonbyrne/sinpi
Browse files Browse the repository at this point in the history
docs for sinpi, vectorize sinpi/sind
  • Loading branch information
StefanKarpinski committed Aug 21, 2013
2 parents 925bb5d + 9e94069 commit a58c84d
Show file tree
Hide file tree
Showing 3 changed files with 1,541 additions and 174 deletions.
6 changes: 6 additions & 0 deletions base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ function cospi(z::Complex)
pizi = pi*zi
complex(cospi(zr)*cosh(pizi), -sinpi(zr)*sinh(pizi))
end
@vectorize_1arg Number sinpi
@vectorize_1arg Number cospi


sinc(x::Number) = x==0 ? one(x) : oftype(x,sinpi(x)/(pi*x))
sinc(x::Integer) = x==0 ? one(x) : zero(x)
Expand Down Expand Up @@ -179,6 +182,7 @@ function sind(x::Real)
return sin(degrees2radians(rx))
end
end
@vectorize_1arg Real sind

function cosd(x::Real)
if isinf(x)
Expand All @@ -205,8 +209,10 @@ function cosd(x::Real)
return cos(degrees2radians(rx))
end
end
@vectorize_1arg Real cosd

tand(x::Real) = sind(x) / cosd(x)
@vectorize_1arg Real tand

for (fd, f) in ((:sind, :sin), (:cosd, :cos), (:tand, :tan))
@eval begin
Expand Down
Loading

0 comments on commit a58c84d

Please sign in to comment.