Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix display of -0.0 to 0.0 #500

Merged
merged 7 commits into from
Dec 14, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ function basic_representation(a::Interval, format=nothing)

local output

a = Interval(_signofzero(a.lo), a.hi)

if format == :standard

aa = round_string(a.lo, sigfigs, RoundDown)
Expand Down Expand Up @@ -219,6 +221,8 @@ function basic_representation(a::Interval{Float32}, format=nothing)

local output

a = Interval(_signofzero(a.lo), a.hi)

if format == :standard

aa = round_string(a.lo, sigfigs, RoundDown)
Expand Down Expand Up @@ -268,6 +272,8 @@ function basic_representation(a::Interval{Rational{T}}, format=nothing) where
output
end

@inline _signofzero(a::Real) = ifelse(iszero(a) && signbit(a), copysign(a, 1), a)

function subscriptify(n::Integer)
dig = reverse(digits(n))
subscript_0 = Int('₀') # 0x2080
Expand Down