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

Numerical improvements #37

Open
bbrk24 opened this issue Mar 18, 2022 · 2 comments
Open

Numerical improvements #37

bbrk24 opened this issue Mar 18, 2022 · 2 comments

Comments

@bbrk24
Copy link

bbrk24 commented Mar 18, 2022

Should we consider bitwise operators? I imagine << and >> will run into parsing issues, but |, &, ^, and ~ should be doable. Alternatively, we could use words for all six. (I have no suggestions for what.)

Why does !0 == !1? They both evaluate to YEAH, NAH! which doesn't make sense to me. Typically, 0 corresponds to one boolean and all other integers to the other. This isn't always completely accurate -- for example, Objective-C does this mod 256 -- but I'd say it's pretty uncontroversial that 0 and 1 should have different boolean values.

Should we have literals for NaN and Infinity? It is possible to get them (0 / 0 and 1 / 0 respectively) but I'd prefer them to have names. They currently print as NaN and inf respectively, so if we give them names then the string conversion has to be updated to match.

The syntax highlighting shows literals like 1e9 as if they're numbers, but they don't work: OI MATE! EXPECTED ; BUT GOT 'e9'. It would be nice to be able to express large or small numbers using scientific notation, or have an exponentation operation (like pow() or **) -- preferably both.

@bbrk24
Copy link
Author

bbrk24 commented Mar 18, 2022

~ should be doable.

I forgot that it's already being used for pattern matching. I don't know how much of a problem that would be.

@bbrk24
Copy link
Author

bbrk24 commented Mar 18, 2022

G'DAY MATE!

I RECKON inf = 1 / 0;
GIMME inf == inf;

CHEERS C***!

Gives Yeah, nah!. x != x is the typical test for NaN; generally Infinity == Infinity.

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

1 participant