For the smallest latency durations, the actual and approximate values
should be exactly the same. Use this property to avoid a division by
zero when the actual latency value is zero.
Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
approximation value of the bin used by fio to store a given latency
actual actual latency value
"""
+
+ # Avoid a division by zero. The smallest latency values have no error.
+ if actual == 0:
+ return approximation == 0
+
delta = abs(approximation - actual) / actual
return delta <= 1/128