-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
FEATURE REQUEST: Add a "roughly" operator #743
Comments
Don't forget that |
I think we already have something like that.
|
It's a less precise equal not a roughly equal print 3 = 3 ! // true
print 3 ~ 3 ! // false because roughly is not equal if 3 = 3.14 {
print 3.1 ! // 3.1
print 3 ! // 3.14
}
if 3 ~ 3.14 {
print 3.1 ! // 3.14
print 3 ! // 3
} |
I don't understand what you mean here.
Why does Also if you want to do |
const const n = 3!
print 3 ~ n ! //false
print 3 = n && 3 ;= n ! // false
const const n = 3.1!
print 3 ~ n ! //true
print 3 = n && 3 ;= n ! // false |
About the other I was wrong for the second if (it's how it would work for 3 = 3.14 ! // Now the variable 3 is set to 3.14 so `print 3` prints `3.14`
3 ~ 3.14 ! // Now the variable 3 is roughly set to 3.14 so `print 3` prints a number close to 3.14 (like `3.1` or `3.1654`)
~ 3 = 3.14! // Now the variables of value around 3 (like `3.1` or `2.98`) are set to 3.14 so `print 3.1` prints `3.14`
~ 2 ~ 3.14! // Now the variables of value around 3 (like `3.1` or `2.98`) are roughly set to 3.14 so `print 2.98` could print `3.1654` |
Are you proposing something that is both a comparator and an assignment at the same time? |
It might be useful to have an operator that says something is roughly like something else:
The precise definition of roughly should depend an a Quantum Random Number Generator so the universe can decide whether or not this is truly roughly equal to the other operand.
The text was updated successfully, but these errors were encountered: