# Issue writing to bit 31

**URL:** <https://forum.inductiveautomation.com/t/issue-writing-to-bit-31/58666>\
**Category:** Ignition\
**Created:** [April 21, 2022, 8:04am UTC](https://forum.inductiveautomation.com/t/issue-writing-to-bit-31/58666 "2022-04-21T08:04:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andreas/32/18981_2.png) [@andreas](https://forum.inductiveautomation.com/u/andreas)\
**Post date:** [April 21, 2022, 8:04am UTC](https://forum.inductiveautomation.com/t/issue-writing-to-bit-31/58666/1 "2022-04-21T08:04:25Z")

</div>

Hi all,

I’m experiencing some issues when trying to write to the last bit of a long data type.  
Bits 0-30 are working as expected ( see below figure with e.g. bit 29 activated, giving me a value of 536870912 ).

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/8/d86e606ac676657f1bb993ff23b80d51b593a700.png)

When writing to bit 31, all bits are set, but the value is correct ( see below figure ).

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/9/f9dace8aa8d778d42c006b2e6048921daa27af4e.png)

I guess this has to do with the long data type being signed?  
Anyone knows if there is a workaround to handle this issue? 🤞🏼

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 21, 2022, 11:57am UTC](https://forum.inductiveautomation.com/t/issue-writing-to-bit-31/58666/2 "2022-04-21T11:57:46Z")

</div>

Longs are 64-bit, not 32.

I can’t find the right manual page but this one is an indirect “proof”.  
[https://docs.inductiveautomation.com/display/DOC81/toLong](https://docs.inductiveautomation.com/display/DOC81/toLong)

---

<div class="post-metadata">

**Author:** ![andreas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andreas/32/18981_2.png) [@andreas](https://forum.inductiveautomation.com/u/andreas)\
**Post date:** [April 21, 2022, 12:15pm UTC](https://forum.inductiveautomation.com/t/issue-writing-to-bit-31/58666/3 "2022-04-21T12:15:44Z")

</div>

Ah, I was using toInt in my read and write expressions on my derived tags, heh… 🫣  
Changed it to toLong, voilá.

Thanks! 😉
