rte_approx.h(3)
π rte_approx.h π
hiii bestie, welcome to the rte_approx.h page β it's part of the Library Functions Manual, section 3, and it's literally the cutest lil corner of DPDK where we do rational approximation math. no cap. let's get into it π¦
β¨ NAME β¨
rte_approx.h
that's it, that's the name, she's self-titled and she knows it π
πΈ SYNOPSIS πΈ
the one and only thing you gotta include:
#include <stdint.h>
π Functions π
two icons, both of them:
int rte_approx (double alpha, double d, uint32_t *p, uint32_t *q)
int rte_approx_64 (double alpha, double d, uint64_t *p, uint64_t *q)
π Detailed Description π
RTE Rational Approximation
ok so picture this: you hand me a rational number alpha, where 0 < alpha < 1, plus a precision d. the goal, the mission, the whole vibe, is to find positive integers p and q such that
alpha - d < p/q < alpha + d
and, and this is the important part, q is minimal. minimal denominator, maximal slay. β¨
π Definition in file rte_approx.h.
π§ Function Documentation π§
int rte_approx (double alpha, double d, uint32_t * p, uint32_t * q)
Find best rational approximation β the 32-bit girly π«Ά
Parameters
alphaβ the rational number you want to approximatedβ the precision you want for the rational approximationpβ pointer to pre-allocated space where the numerator of the rational approximation will be stored when the operation is successfulqβ pointer to pre-allocated space where the denominator of the rational approximation will be stored when the operation is successful
Returns
0 upon success, error code otherwise π (yes we do error codes here, it's giving responsible)
int rte_approx_64 (double alpha, double d, uint64_t * p, uint64_t * q)
Find best rational approximation (64 bit version) β same energy, bigger numbers, main character vibes π
Parameters
alphaβ the rational number you want to approximatedβ the precision you want for the rational approximationpβ pointer to pre-allocated space where the numerator of the rational approximation will be stored when the operation is successfulqβ pointer to pre-allocated space where the denominator of the rational approximation will be stored when the operation is successful
Returns
0 upon success, error code otherwise π (same deal, stay safe out there)
π Author π
Generated automatically by Doxygen for DPDK from the source code. so technically Doxygen wrote this, not a person, and honestly? it ate. π€β¨
aaaand that's the whole page, bestie!! this was rte_approx.h from DPDK, Version 25.11.3 β mwah, go approximate something gorgeous, ily πππ¦πΈπ
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms