# InexactError while using the PiGPIO.jl package from JuliaBerry

**URL:** <https://discourse.julialang.org/t/inexacterror-while-using-the-pigpio-jl-package-from-juliaberry/26593>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [July 20, 2019, 9:28pm UTC](https://discourse.julialang.org/t/inexacterror-while-using-the-pigpio-jl-package-from-juliaberry/26593 "2019-07-20T21:28:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akshayh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/akshayh/32/7654_2.png) [@akshayh](https://discourse.julialang.org/u/akshayh)\
**Post date:** [July 20, 2019, 9:28pm UTC](https://discourse.julialang.org/t/inexacterror-while-using-the-pigpio-jl-package-from-juliaberry/26593/1 "2019-07-20T21:28:30Z")

</div>

Hi,

I am trying to read sensor (MPU 6050) data using Raspberry Pi 3 and Julia using the PiGPIO package. I have connected my Pi to the pigpio daemon over a network.

When I am trying to use “i2c\_write\_byte” function something like i2c\_write\_byte(pi, 2, 0x19), I end up with the following error:

InexactError: check\_top\_bit(UInt32, 4294967271)

Stacktrace:  
[1] throw\_inexacterror(::Symbol, ::Any, ::UInt32) at ./boot.jl:567  
[2] check\_top\_bit at ./boot.jl:581 [inlined]  
[3] toInt32 at ./boot.jl:630 [inlined]  
[4] Type at ./boot.jl:716 [inlined]  
[5] convert at ./number.jl:7 [inlined]  
[6] \_u2i(::UInt32) at /home/pi/.julia/packages/PiGPIO/e5h1O/src/pi.jl:72  
[7] i2c\_write\_byte(::Pi, ::Int32, ::UInt8) at /home/pi/.julia/packages/PiGPIO/e5h1O/src/i2c.jl:99  
[8] top-level scope at In[51]:1

I tried to look up the function in the boot.jl file in the line mentioned but wasn’t able to figure it out since I am new to coding. Could someone please explain what the actual error is and also how to rectify it if possible?

Thank you

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [July 20, 2019, 9:37pm UTC](https://discourse.julialang.org/t/inexacterror-while-using-the-pigpio-jl-package-from-juliaberry/26593/2 "2019-07-20T21:37:20Z")

</div>

It comes from the function at  
[https://github.com/JuliaBerry/PiGPIO.jl/blob/d3c8a4dd3a41548378f7054c85fec0ad00107e26/src/pi.jl#L71-L79](https://github.com/JuliaBerry/PiGPIO.jl/blob/d3c8a4dd3a41548378f7054c85fec0ad00107e26/src/pi.jl#L71-L79)

The function doesn’t really make sense to me, converting an unsigned integer to an Int32 can never give a negative result which is what is being checked.

I am guessing that instead of `v = convert(Int32, x)`, what was intended was `x % Int32`.
