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

Allow operations with float values for int data type #83

Closed
heinezen opened this issue Oct 4, 2020 · 1 comment
Closed

Allow operations with float values for int data type #83

heinezen opened this issue Oct 4, 2020 · 1 comment
Labels
proposal pending discussion about something to do specification involves the nyan language specification

Comments

@heinezen
Copy link
Member

heinezen commented Oct 4, 2020

Currently, the int data type operations only allow integers as operands. This limits operations on int members somewhat, especially for multiplications.

int operations other than = should also allow floats to be used as operands. The result of the operation should be typecast internally to int, i.e. the resulting value is floored.

SomeObject():
    member : int = 4
    other_member : int = 9

Patch<SomeObject>():
    member *= 2.5f       # result: member = 10  (multiplication: 4 * 2.5 = 10.0 -> 10)
    other_member *= 1.5f # result: c = 13       (multiplication: 9 * 1.5 = 13.5 -> 13)
@heinezen heinezen added proposal pending discussion about something to do specification involves the nyan language specification labels Oct 4, 2020
@heinezen heinezen linked a pull request Oct 5, 2020 that will close this issue
8 tasks
@TheJJ
Copy link
Member

TheJJ commented Aug 20, 2021

Done in #87.

@TheJJ TheJJ closed this as completed Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal pending discussion about something to do specification involves the nyan language specification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants