Question:
I’ve been looking around for a way to extended a boolean function in boolean algebra into the classical algebra and I think all I need is Multiplication and Addition to do that so assuming that a,b are two unsigned integers in the range [0, 232 – 1], we know thata*b
. I tried the following:f(x,y)
is a boolean functionEDIT: as @DavidGrayson mentioned I should clarify more so, what I’m looking for is a way of describing a * b using a combination of bitwise operators with or without algebraic operators (+,-, … ) Just like the example of a + b above we can see that we’ve described the algebraic operation ‘+’ with bitwise operators, so can we do the same with multiplication?
Answer:
I still have no idea why you are asking this question, but you specified that you are looking fora way of describing a * b using a combination of bitwise operators with or without algebraic operators
You also explicitly said in the comments that
*
is an algebraic operator we are allowed to use.Later, you added that there must be a boolean operator linking a and b.
So I will answer your question by saying:
a * b = (a | (0 & (a | b))) * (b | 0)
This is a formula for
a * b
that uses bitwise operators so it meets all your conditions.If you have better answer, please add a comment about this, thank you!