Skip to content
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

in index.markdown, need chg bitwise C ops & and | to && and || #8

Open
dashyr opened this issue Mar 6, 2017 · 3 comments
Open

in index.markdown, need chg bitwise C ops & and | to && and || #8

dashyr opened this issue Mar 6, 2017 · 3 comments

Comments

@dashyr
Copy link

dashyr commented Mar 6, 2017

The first line is the equivalent of 3 < 4 & 20 < 30 in a C-based language. The second line is the equivalent of 3 < 4 | 20 > 30.

I believe that the bitwise operators above (& , |) should be changed to the logical operators (&& , ||) as below.

The first line is the equivalent of 3 < 4 && 20 < 30 in a C-based language. The second line is the equivalent of 3 < 4 || 20 > 30.

Thank you for making EasyForth.

@PSLLSP
Copy link

PSLLSP commented May 18, 2018

+1

@temyurchenko
Copy link

The operators are bitwise, so it only makes sense to equate them to bitwise operators in C.

@ruv
Copy link

ruv commented May 11, 2024

I believe that the bitwise operators above (& , |) should be changed to the logical operators (&& , ||)

In Forth, and, or, xor, invert are bitwise. So it's better to illustrate them with bitwise operators in C.

In the same time, a normalized true flag in Forth is represented by a single-cell value with all bits set. So, the words < and > return -1 on true, and the result of those expressions will be -1 in Forth, and 1 in C, regardless whether logic or bitwise operators are used in C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants