Using Winston corrupts BigInts?

The following weird behavior appears with julia 1.7.1 and Winston v0.15.2

julia> big(1//2)
1//2
julia> using Winston
Gtk-Message: 14:17:40.676: Failed to load module "canberra-gtk-module"
Gtk-Message: 14:17:40.677: Failed to load module "canberra-gtk-module"

julia> big(1//2)
0//0

I reported this weird behavior on the Winston bug tracker but I don’t expect it to be fixed there since similar bugs have been already reported and remain open.

1 Like

That looks like memory corruption.

It does not seem to be about Rationals rather than just BigInt.

julia> using Winston
julia> big(1)
0
julia> big(1) + big(2) == 3
true

julia> big(1) + big(2) == 2
false

julia> big(1) + big(2)
0

The problem seems to be about Winston.jl messing with show/display for BigInts.

3 Likes

I think this is about Base.range, extended by Winston.jl.

In the line winston.jl:495,

range(a::Real, b::Real) = (a <= b) ? (ceil(Int, a):floor(Int, b)) :
                                     (floor(Int, a):-1:ceil(Int, b))

This breaks the behavior for BigInts since BigInt is a Real. This extended version is called, which is incorrect for BigInt.

I do not know why Winston.jl extends range in such a way. At least, what can be done is to limit the Real parameters to Union{AbstractFloat, AbstractIrrational, Rational}.

1 Like