Skip to content

Commit

Permalink
Remove Base.convert(::Type{Decimal}, ::Real)
Browse files Browse the repository at this point in the history
The method is unnecessary. We define constructors from `Real`s, which is
enough for the fallback `convert` method to work.

This commit also removes a useless test file.
  • Loading branch information
barucden committed Nov 19, 2024
1 parent 1a4e538 commit 3a1be85
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 20 deletions.
2 changes: 0 additions & 2 deletions src/conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ function Decimal(x::AbstractFloat)
return Decimal(s, c, q)
end

Base.convert(::Type{Decimal}, x::Real) = Decimal(x)

function Base.BigFloat(x::Decimal)
y = BigFloat(x.c)
if x.q 0
Expand Down
10 changes: 0 additions & 10 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,8 @@ using Test

@testset "Decimals" begin

global d = [
Decimal(false, 2, -1)
Decimal(false, 1, -1)
Decimal(false, 100, -4)
Decimal(false, 1512, -2)
Decimal(true, 3, -2)
Decimal(true, 4, -6)
]

include("test_arithmetic.jl")
include("test_bigint.jl")
include("test_constructor.jl")
include("test_context.jl")
include("test_decimal.jl")
include("test_equals.jl")
Expand Down
8 changes: 0 additions & 8 deletions test/test_constructor.jl

This file was deleted.

0 comments on commit 3a1be85

Please sign in to comment.