byte numCount = 100; //number of interupts to count.
byte multiplier = 6; //Set this number according to how many pulses you have per 1 revolution.
//(60 / the number of pulses you have). eg, 60/4 pulse = a multiplier of 15.
........
float period = 0.0;
float previousPeriod = 0.0;
.......
Arduinos (with rare exceptions) do not have Floating Point Units, only slow and crappy 32-bit FP.
Work with micros, display seconds.
This is not going to give RPM.
if ((period <= previousPeriod - bufferPeriod) || (period >= previousPeriod + bufferPeriod))
{
rpm = numCount * multiplier * (1000000.0 / period);
displayRPM();
}
RPS = numCount * 1000000 / multiplier / period; // numCount slots pass, multiplier slots pass per rev.
( numCount * 1000000 / multiplier ) gives millionths of a rev, period is UL elapsed millionths of a second.
1200 RPM is 20 RPS, 120 slots/sec, and numCount == 100, takes 833333 micros for 16.667
100000000 uCounts / 6 / 833333 = 20.000008 RPS, 20 uRevs/uSec.
20 RPS * 60 Sec/Min = 1200 RPM
TBH, I did integer math a lot at work long before FPU's became standard in CPU's (x486 IIRC) and in school math was on paper, chalkboard, or in the head for me. I have a gift for it and years of practice that hammered it in deep. If you go back to pencil and paper which I sometimes still do, where the decimal goes is all in the units. It's functionally the same as fixed-point but less fool-yourself.
Consider how we talk about mV with leds. That is thousands of volt and no decimal, if we want more we go to microvolts (a digitalRead soaks up about 1 uA), 6 places accuracy so if 2 or 3 are lost to division rounding there's still 3 or 4 places precise.
Integer operations mostly beat floating point, except at multiply or divide by 10 and there is a FAST div/10 up on the Arduino Playground.
And sometime have a look at 64-bit type unsigned long long, can hold any UL * any UL when scaling 32-bit unsigned long (UL) --- then you divide back down into a 32-bit. Morris Dovey wrote a clock library that uses ULL timers, good for billions of years!