20 #ifndef FOOTAG_FOOTOL_H
21 #define FOOTAG_FOOTOL_H
33 static inline void footol_nom(
38 tol->min = tol->max = tol->nom = nom;
41 static inline void footol_minmax(
49 tol->nom = min + fabs(max - min) / 2;
52 static inline void footol_minmaxnom(
64 static inline void footol_pm(
71 tol->min = nom - fabs(plusminus);
72 tol->max = nom + fabs(plusminus);
75 static inline struct footol footol_auto(
81 if (fabs(b) < fabs(a)) {
82 footol_pm(&ret, a, b);
84 footol_minmax(&ret, a, b);
89 static inline double footol_range(
90 const struct footol *
const tol
93 return tol->max - tol->min;
96 static const double FOOTOL_MM_PER_INCH = 25.4;
98 static inline double footol_inchtomm(
102 return mmval * FOOTOL_MM_PER_INCH;
105 static inline struct footol footol_autoi(
110 return footol_auto(footol_inchtomm(a), footol_inchtomm(b));