• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Multiplication using bitwise operations

Resolved: Multiplication using bitwise operations

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

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 that
which is half of what I want, now I need to find what is a*b. I tried the following:
which means that in any multiplication there is third variable I should keep in mind? what I’m looking for is something like this
where f(x,y) is a boolean function
EDIT: 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 for

a 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!

bitwise-operators math
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Best way to create 3d matrix of variables in PULP

24/03/2023

Resolved: Openlayers: Update clusters depending on filter (geometryFunction)

24/03/2023

Resolved: Getting ‘502 Bad Gateway’ while deploying Springboot app in EKS

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.