Skip to content

Commit 575812a

Browse files
author
Michael Abbott
committed
006
1 parent ed1a7e0 commit 575812a

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Bhaskara"
22
uuid = "0ff2d225-4740-5ba6-bff6-8e455aafa9c9"
33
authors = ["Michael Abbott"]
4-
version = "0.1.0"
4+
version = "0.1.1"
55

66
[deps]
77
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

src/Bhaskara.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ module Bhaskara
33
export bsin, b2sin, bcos
44

55

6-
bsin) = 16-θ)θ / (5π^2 - 4-θ)θ)
6+
bsin::T) where {T<:Number} = 16-θ)θ / (5T(π)^2 - 4-θ)θ)
77

88
b2sin(θ) = sign(θ) * bsin(abs(θ))
99

10-
sin::T) where T<:Number = b2sin(mod+π, T(2)*π) - π)
10+
sin::T) where {T<:Number} = b2sin(mod+π, T(2)*π) - π)
1111

1212

1313
sind180(x) = 4(180-x)x / (40500 - (180-x)x)
@@ -17,9 +17,9 @@ sind360(x) = sign(x) * sind180(abs(x))
1717
sind(x::Number) = sind360(mod(x+180,360)-180)
1818

1919

20-
bcos) = (π^2 - 4θ^2) / (π^2+θ^2)
20+
bcos::T) where {T<:Number} = (T(π)^2 - 4θ^2) / (T(π)^2+θ^2)
2121

22-
cos::T) where T<:Number = b2sin(mod-π/T(2), T(2)*π) - π)
22+
cos::T) where {T<:Number} = b2sin(mod-π/T(2), T(2)*π) - π)
2323

2424

2525
tan::Number) = sin(θ) / cos(θ)

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ test(f, g, r=0:0.001:π, e=0.002) = maximum(@. abs(f(r)-g(r)) ) < e
1515
@test test(Bhaskara.cos, Base.cos, -3π:0.001:3π)
1616

1717
@test bsin(big(0.1)) isa BigFloat
18+
@test bsin(Float32(0.2)) isa Float32
19+
@test bcos(big(0.1)) isa BigFloat
20+
@test bcos(Float32(0.2)) isa Float32
21+

0 commit comments

Comments
 (0)