Are 32-bit floats sufficient for microseconds-to-RPM conversion?
Engine ECU's calculate engine RPM by measuring the delay (in microseconds) between pulses from a crank position sensor.
Converting from micros to RPM can be performed as a single division (60 million / delay), but do 32-bit floats have sufficient resolution to produce usable results? We can write a simple C program to answer this.
Our expected range of values spans from cranking speed (about 240 RPM, or 250,000 micros) to engine redline (about 10,000 RPM, or 6,000 micros).
250000 micros -> 240.0000000000000000 rpm, (as bytes: 0x43700000) 250001 micros -> 239.9990386962890625 rpm, (as bytes: 0x436fffc1) 6000 micros -> 10000.0000000000000000 rpm, (as bytes: 0x461c4000) 6001 micros -> 9998.3339843750000000 rpm, (as bytes: 0x461c3956)