Skip to content

Conversation

tr8dr
Copy link

@tr8dr tr8dr commented Jun 24, 2023

Added a unary '+' operator (+variable) to provide symmetry with the unary '-' operator (-variable). These operators are supported by most languages, so makes sense to include. Although unary '+' is effectively a NOP, it provides clarity in coding situations where want to contrast with the negation, where one may have code applying + and - to some magnitude.

In scripting often have symmetric rules, such as:

static rule_type1(alpha, beta, threshold1, threshold2) {
    return (alpha > -threshold1) && (beta < +threshold2)
}
static rule_type2(alpha, beta, threshold1, threshold2) {
    return (alpha < +threshold1) && (beta > -threshold2)
}

Having + and - magnitude clarifies the rules for us.

@mhermier
Copy link
Contributor

mhermier commented Jun 24, 2023 via email

@ruby0x1
Copy link
Member

ruby0x1 commented Jun 24, 2023

Thanks for the PR though @tr8dr , we always appreciate time spent

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

Successfully merging this pull request may close these issues.

3 participants