Divide in C code for PIC

Thread Starter

FroceMaster

Joined Jan 28, 2012
708
Hi
Need to do this.
1/25000*125000*60
if i do like this,

Code:
timer = (TMR1H << 8)| TMR1L;

  tid_rpm= timer *(timer_tick+1);

nyrpm =1/tid_rpm*125000*60;
Any hint on doing this ?

have define all as float.
 
Last edited:

ErnieM

Joined Apr 24, 2011
8,415
Any hint on doing what?

If you expect any help you need to state what you are trying to accomplish.

Unless 1/187,500,000,000 = 5.3333333333333333333333333333333e-12 is the answer you need.
 

kubeek

Joined Sep 20, 2005
5,796
And i thought the answer was 300.
The correct order of operations would be 125000*60/25000 in order to prevent loss of precision.
 
Top