Bit wise square rooting

Im trying to make a bitwise function that will return a number x square rooted, i have a solution but it isnt legal because i cant figure out how to do it without using *. The only operations i can use are !,~,|,&,<<,>>,+,^

i also cant use loops or if statements... sigh
Last edited on
What's the type of x? Floating point or integer?
This is a homework problem. The type will be integer.

Remember that shift operations (<</>>) are equivalent to multiply/divide by two, and x&1 is equivalent to x%2.

Good luck!
hmm ok ty Duoas ill try and see what i can figure it out with what you said.
Topic archived. No new replies allowed.