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

Implement MIN and MAX functions #726

Closed
wants to merge 1 commit into from
Closed

Conversation

Rangi42
Copy link
Contributor

@Rangi42 Rangi42 commented Feb 3, 2021

Fixes #723

@Rangi42 Rangi42 force-pushed the min-max branch 7 times, most recently from 01bab91 to 992bce6 Compare February 17, 2021 15:45
@Rangi42 Rangi42 force-pushed the min-max branch 2 times, most recently from 605f718 to e3ad08c Compare February 21, 2021 21:17
@Rangi42 Rangi42 force-pushed the min-max branch 4 times, most recently from bee3a10 to 3785d89 Compare March 5, 2021 16:30
@Rangi42 Rangi42 added enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM labels Mar 24, 2021
@Rangi42
Copy link
Contributor Author

Rangi42 commented Mar 24, 2021

This could be more relevant even when/if user-defined functions are implemented, if rgblink also supported MIN and MAX.

@Rangi42 Rangi42 force-pushed the min-max branch 5 times, most recently from 814c513 to ce8c22b Compare March 31, 2021 20:12
@Rangi42 Rangi42 force-pushed the min-max branch 2 times, most recently from eeb8320 to f9c0048 Compare April 13, 2021 14:33
@Rangi42 Rangi42 force-pushed the min-max branch 4 times, most recently from 048d7ea to 3683b3f Compare April 23, 2021 13:37
@Rangi42 Rangi42 force-pushed the min-max branch 2 times, most recently from e670cb2 to 9918357 Compare April 29, 2021 13:01
@Rangi42
Copy link
Contributor Author

Rangi42 commented Jul 4, 2021

User-defined functions (#201) probably won't be available for a long time, but when they are they'll make this easy to define yourself (as long as they support a ternary operator, recursion, and variable arguments):

DEF min(x) = x
DEF min(x, y) = x < y ? x : y
DEF min(x, y, ...) = min(min(x, y), ...)

(or just the DEF min(x, y) = x < y ? x : y line if you only need a simple two-arg min)

Until then, it's not really something that needs building into the language: just use IF/ELSE.

@Rangi42 Rangi42 closed this Jul 4, 2021
@Rangi42 Rangi42 deleted the min-max branch July 4, 2021 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] More built-in math functions (MIN, MAX, ABS/SGN)
1 participant