Skip to content

Commit

Permalink
Add tests for dirty zero
Browse files Browse the repository at this point in the history
  • Loading branch information
halleysfifthinc committed Aug 3, 2018
1 parent c34c44e commit 922a246
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/vaxfloatd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
# Both IEEE zeros should be converted to Vax true zero
@test VaxFloatD(-0.0) === VaxFloatD(0.0) === zero(VaxFloatD)

# Dirty zero
@test convert(Float64, VaxFloatD(UInt64(0x08))) === zero(Float64)

# Numbers smaller than floatmin(VaxFloatD) should underflow
@test VaxFloatD(prevfloat(convert(Float64, floatmin(VaxFloatD)))) === zero(VaxFloatD)
@test VaxFloatD(convert(Float64, floatmin(VaxFloatD))) === floatmin(VaxFloatD)
Expand Down
3 changes: 3 additions & 0 deletions test/vaxfloatf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
# Both IEEE zeros should be converted to Vax true zero
@test VaxFloatF(-0.0f0) === VaxFloatF(0.0f0) === zero(VaxFloatF)

# Dirty zero
@test convert(Float32, VaxFloatF(UInt32(0x40))) === zero(Float32)

# Numbers smaller than floatmin(VaxFloatF) should underflow
@test VaxFloatF(prevfloat(convert(Float32, floatmin(VaxFloatF)))) === zero(VaxFloatF)
@test VaxFloatF(convert(Float32, floatmin(VaxFloatF))) === floatmin(VaxFloatF)
Expand Down
3 changes: 3 additions & 0 deletions test/vaxfloatg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
# Both IEEE zeros should be converted to Vax true zero
@test VaxFloatG(-0.0) === VaxFloatG(0.0) === VaxFloatG(zero(UInt64))

# Dirty zero
@test convert(Float64, VaxFloatG(UInt64(0x08))) === zero(Float64)

# Numbers smaller than floatmin(VaxFloatG) should underflow
@test VaxFloatG(prevfloat(convert(Float64, floatmin(VaxFloatG)))) === zero(VaxFloatG)
@test VaxFloatG(convert(Float64, floatmin(VaxFloatG))) === floatmin(VaxFloatG)
Expand Down

0 comments on commit 922a246

Please sign in to comment.