Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

is it possible

Status
Not open for further replies.

finst

New Member
i would like to do 8 bit division 2/5 and add quotient 0.4 with some integer value (for example 3) then result is 3.4.

what is the procedure for the above calculation. can anybody know algorithm or program?
plz send it to me immediately
 
finst said:
i would like to do 8 bit division 2/5 and add quotient 0.4 with some integer value (for example 3) then result is 3.4.

what is the procedure for the above calculation. can anybody know algorithm or program?
plz send it to me immediately

I'm not very sure what you're wanting?, you've already given what you need - calling the three values x, y, and z you need to calculate:

(x/y) + z

As it's a fixed calculation, do it in two stages, first divide x by y, then add z to the result.

You don't mention what language you are wanting to use, nor what system it's for - so anything else would only be speculation.
 
scale the division so you can work with integers. For example make it
20 / 5 wich is 4 then add 30 so the result will be 34. If you print the value on a display you can just add a decimal point beween the 3 and 4.

Pic's aren't very good at math, specially floating point.

For code snippets about multiplying and dividing go to the pic list
www.piclist.com
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top