1 #ifndef liblogintpack_h
2 #define liblogintpack_h
11 float l =
log(fabs(x));
12 float centered = (l-lmin)/(lmax-lmin)*
base;
13 int8_t
r=ceil(centered);
14 if(centered >=
base-1)
return r=
base-1;
15 if(centered < 0)
return r=0;
23 float l =
log(fabs(x));
24 float centered = (l-lmin)/(lmax-lmin)*
base;
26 if(centered >=
base-1)
return r=
base-1;
27 if(centered < 0)
return r=0;
36 float l=lmin+
abs(i)/basef*(lmax-lmin);
38 if(i<0)
return -val;
else return val;
double unpack8log(int8_t i, double lmin, double lmax, uint8_t base=128)
int8_t pack8log(double x, double lmin, double lmax, uint8_t base=128)
int8_t pack8logCeil(double x, double lmin, double lmax, uint8_t base=128)
Abs< T >::type abs(const T &t)