Jump to content

Multipy by 0.8 with only add and shift

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
tman_ndsu08

tman_ndsu08

    Newbie

  • Members
  • Pip
  • 3 posts
I'm trying to figure out how to multiply by a binary number by 0.8 if you can only add numbers to it and shift it left or right once at a time.

#2
tman_ndsu08

tman_ndsu08

    Newbie

  • Members
  • Pip
  • 3 posts
Nevermind, my instructor is a complete tool.

His solution is that .8 is approx. equal to .75 so we should divide the number by 2 and divide it by 4, then add those together.

#3
Crane

Crane

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 398 posts
That doesn't make a lot of sense to me. .8 = .75? How is that possible? 3/4 = .75 but not .8.

#4
tman_ndsu08

tman_ndsu08

    Newbie

  • Members
  • Pip
  • 3 posts
It's approximately equal, according to him.


I don't think it's possible to multiply by .8 if you can only shift right (divide by 2), shift left (multiply by 2), and add.


Just fyi, I'm using a PIC so there is no floating point operation.