-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binary number support #87
Comments
I think this would be a great addition to the language! We can even add the symbols <, >, |, &, ¬ to represent shift left, right, or, and and not to solve math without changing almost anything of the current code! |
I think So for the normal statements, we probably have to: 1. check if there's a fraction, 2. convert to int if no fraction (error if so), 3. perform bitwise operation, 4. convert back to float. This is how Lua does it according to manual section 3.4.3, since Lua also only has a single number type as far as the programmer is concerned. However, if we add a sibling to |
Oh right, we are using floating point numbers... I didn't think about that. I like what you are saying though. There's no real need to add it to |
@dvkt should I close this? I don't really think that we'll end up using this in LDPL an in any case we could implement it as part of the standard library. |
It would be nice if LDPL could work with binary data. It would probably need two things:
0b1010
) and hex (0xFF
) number literals.Maybe the commands could look like this:
BITWISE A AND B IN C
BITWISE A OR B IN C
BITWISE A XOR B IN C
BITWISE NOT A IN C
BITWISE SHIFT A LEFT BY B IN C
BITWISE SHIFT A RIGHT BY B IN C
GET BIT AT N FROM A IN C
Would this be a good candidate for the language or should it be an extension?
The text was updated successfully, but these errors were encountered: