Hello @Bohnstedt, Timo and welcome to Microsoft Q&A.
To my understanding, your goal is to grab the first / lowest order bit from some datatype.
But you are hung up on converting types. Specifically the toBinary function.
I agree things are weird with that toBinary function. I have struggled to help people with it in the past, as it doesn't appear to do what people expect.
putting aside the toBinary function, I do have a solution for you.
I think what you are looking for is:
bitwiseAnd( myInteger , 0x1 )
All data is binary in its truest form. The data types are just different ways to read and interpret the bits. This is why we can use bitwiseAnd without needing to convert to binary. I would argue that integers are easier to work with than binary.
From my tests, toBinary(stuff) has the same visual representation as toBase64(stuff)