# Printf is broken with BigInt on master

**URL:** <https://discourse.julialang.org/t/printf-is-broken-with-bigint-on-master/3952>\
**Category:** Internals & Design\
**Created:** [May 27, 2017, 6:48pm UTC](https://discourse.julialang.org/t/printf-is-broken-with-bigint-on-master/3952 "2017-05-27T18:48:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [May 27, 2017, 6:48pm UTC](https://discourse.julialang.org/t/printf-is-broken-with-bigint-on-master/3952/1 "2017-05-27T18:48:59Z")

</div>

I noticed this when answering a question here on Discourse:

```julia
julia> @printf("%d", big(1))
ERROR: UndefVarError: GMP not defined
Stacktrace:
 [1] decode(::Int64, ::BigInt) at ./printf.jl:884
 [2] decode_dec(::Base.TTY, ::BigInt, ::String, ::Int64, ::Int64, ::Char) at ./printf.jl:798

```

This was broken by the change: [https://github.com/JuliaLang/julia/pull/21654](https://github.com/JuliaLang/julia/pull/21654)  
(apparently, there are no unit tests for printf on BigInt that hit the two functions where this got broken)

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [May 27, 2017, 8:34pm UTC](https://discourse.julialang.org/t/printf-is-broken-with-bigint-on-master/3952/2 "2017-05-27T20:34:03Z")

</div>

Note: the fix for this is simply to add:

```julia
using Base.GMP: MPZ

```

on line 4 after:

```julia
module Printf

```

---

<div class="post-metadata">

**Author:** ![rfourquet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rfourquet/32/3610_2.png) [@rfourquet](https://discourse.julialang.org/u/rfourquet)\
**Post date:** [May 28, 2017, 12:13pm UTC](https://discourse.julialang.org/t/printf-is-broken-with-bigint-on-master/3952/3 "2017-05-28T12:13:50Z")

</div>

Thanks Scott! And sorry for the inconvenience. Fix at [https://github.com/JuliaLang/julia/pull/22104](https://github.com/JuliaLang/julia/pull/22104).
