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

add __abs__ for cfix and sfix #39

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lance6716
Copy link
Contributor

tested with these code

a = cfix(0.02)
b = cfix(-0.02)
c = sfix(0.02)
d = sfix(-0.02)

test(abs(a), a)
test(abs(b), -b)

test(abs(c), a)
test(abs(d), -b)

@mkskeller
Copy link
Contributor

This is not very efficient. Keep in mind that comparisons are relatively expensive, and it's not necessary to do two comparison just to find out the sign of a value.

@lance6716
Copy link
Contributor Author

Could there be a data type of secret bool for comparison? Such as GF(p) and GF(2^n) of n = 1 and p is huge.

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.

2 participants