Absolute values #909
Unanswered
infinite-pursuits
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Also is there a general rule of thumb for setting the value of limit? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am trying to write a circuit to do checks of the kind Ax = b. Due to rounding errors in converting the variables to integers, the values are only approximately equal. So I need to check if Ax - b is a small value, which can be done with api.AssertIsLessOrEqual(Ax-b, limit). However, I do not know if Ax > b or b>Ax --> so sometimes the api call works other times it fails. One way to circumvent this issue is to square the terms and call api.AssertIsLessOrEqual((Ax-b)^2, limit^2).
However, is there a better way to do this? I basically need absolute values.
Beta Was this translation helpful? Give feedback.
All reactions