DPDK
2.0.0

#include <stdint.h>
Functions  
int  rte_approx (double alpha, double d, uint32_t *p, uint32_t *q) 
RTE Rational Approximation
Given a rational number alpha with 0 < alpha < 1 and a precision d, the goal is to find positive integers p, q such that alpha  d < p/q < alpha + d, and q is minimal.
int rte_approx  (  double  alpha, 
double  d,  
uint32_t *  p,  
uint32_t *  q  
) 
Find best rational approximation
alpha  Rational number to approximate 
d  Precision for the rational approximation 
p  Pointer to preallocated space where the numerator of the rational approximation will be stored when operation is successful 
q  Pointer to preallocated space where the denominator of the rational approximation will be stored when operation is successful 