• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JuliaLang / julia / 1285

25 Sep 2025 09:41PM UTC coverage: 70.929% (-6.0%) from 76.923%
1285

push

buildkite

web-flow
Fix gcdx and lcm with mixed signed/unsigned arguments (#59628)

Add `gcdx(a::Signed, b::Unsigned)` and `gcdx(a::Unsigned, b::Signed)`
methods to fix #58025:
```julia
julia> gcdx(UInt16(100), Int8(-101))  # pr
(0x0001, 0xffff, 0xffff)

julia> gcdx(UInt16(100), Int8(-101))  # master, incorrect result
(0x0005, 0xf855, 0x0003)
```

Also add the equivalent methods for `lcm` to fix the systematic
`InexactError` when one argument is a negative `Signed` and the other is
any `Unsigned`:
```julia
julia> lcm(UInt16(100), Int8(-101))  # pr
0x2774

julia> lcm(UInt16(100), Int8(-101))  # master, error
ERROR: InexactError: trunc(UInt16, -101)
Stacktrace:
 [1] throw_inexacterror(func::Symbol, to::Type, val::Int8)
   @ Core ./boot.jl:866
 [2] check_sign_bit
   @ ./boot.jl:872 [inlined]
 [3] toUInt16
   @ ./boot.jl:958 [inlined]
 [4] UInt16
   @ ./boot.jl:1011 [inlined]
 [5] convert
   @ ./number.jl:7 [inlined]
 [6] _promote
   @ ./promotion.jl:379 [inlined]
 [7] promote
   @ ./promotion.jl:404 [inlined]
 [8] lcm(a::UInt16, b::Int8)
   @ Base ./intfuncs.jl:152
 [9] top-level scope
   @ REPL[62]:1
```

Inspired by
https://github.com/JuliaLang/julia/pull/59487#issuecomment-3258209203.
The difference is that the solution proposed in this PR keeps the
current correct result type for inputs such as `(::Int16, ::UInt8)`.

10 of 10 new or added lines in 1 file covered. (100.0%)

4780 existing lines in 122 files now uncovered.

50633 of 71385 relevant lines covered (70.93%)

7422080.26 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/stdlib/Markdown/src/IPython/IPython.jl
1
# This file is a part of Julia. License is MIT: https://julialang.org/license
2

3
mutable struct LaTeX <: MarkdownElement
UNCOV
4
    formula::String
×
5
end
6

7
@trigger '$' ->
×
8
function tex(stream::IO, md::MD)
9
    result = parse_inline_wrapper(stream, "\$", rep = true)
3✔
10
    return result === nothing ? nothing : LaTeX(result)
3✔
11
end
12

13
function blocktex(stream::IO, md::MD)
3✔
14
    withstream(stream) do
3✔
15
        ex = tex(stream, md)
3✔
16
        if ex ≡ nothing
3✔
17
            return false
3✔
18
        else
UNCOV
19
            push!(md, ex)
×
UNCOV
20
            return true
×
21
        end
22
    end
23
end
24

UNCOV
25
show(io::IO, tex::LaTeX) =
×
26
    print(io, '$', tex.formula, '$')
27

UNCOV
28
latex(io::IO, tex::LaTeX) =
×
29
    println(io, "\$\$", tex.formula, "\$\$")
30

UNCOV
31
latexinline(io::IO, tex::LaTeX) =
×
32
    print(io, '$', tex.formula, '$')
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc