-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from barucden/em-overhaul
Clean-up
- Loading branch information
Showing
13 changed files
with
147 additions
and
169 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,35 +3,36 @@ | |
# @author [email protected] (Jack Peterson), 7/3/2014 | ||
|
||
module Decimals | ||
import Base: ==, +, -, *, /, <, <=, float, inv, round, trunc | ||
|
||
export Decimal, | ||
decimal, | ||
number, | ||
normalize | ||
export Decimal, | ||
decimal, | ||
number, | ||
normalize | ||
|
||
const DIGITS = 20 | ||
const DIGITS = 20 | ||
|
||
# Numerical value: (-1)^s * c * 10^q | ||
struct Decimal <: AbstractFloat | ||
s::Integer # sign can be 0 (+) or 1 (-) | ||
c::BigInt # coefficient (significand), must be non-negative | ||
q::Integer # exponent | ||
end | ||
# Numerical value: (-1)^s * c * 10^q | ||
struct Decimal <: AbstractFloat | ||
s::Bool # sign can be 0 (+) or 1 (-) | ||
c::BigInt # coefficient (significand), must be non-negative | ||
q::Int # exponent | ||
|
||
# Convert between Decimal objects, numbers, and strings | ||
include("decimal.jl") | ||
Decimal(s::Integer, c::Integer, e::Integer) = new(Bool(s), c, e) | ||
end | ||
|
||
# Convert between Decimal objects, numbers, and strings | ||
include("decimal.jl") | ||
|
||
# Decimal normalization | ||
include("norm.jl") | ||
# Decimal normalization | ||
include("norm.jl") | ||
|
||
# Addition, subtraction, negation, multiplication | ||
include("arithmetic.jl") | ||
# Addition, subtraction, negation, multiplication | ||
include("arithmetic.jl") | ||
|
||
# Equality | ||
include("equals.jl") | ||
# Equality | ||
include("equals.jl") | ||
|
||
# Rounding | ||
include("round.jl") | ||
# Rounding | ||
include("round.jl") | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ using Test | |
|
||
@testset "Decimal constructor" begin | ||
|
||
@test isa(d, Array{Decimal,1}) | ||
@test d isa Vector{Decimal} | ||
|
||
end |
Oops, something went wrong.