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);
20 int8_t
pack8log(
double x,
double lmin,
double lmax, uint8_t
base=128)
23 float l =
log(fabs(x));
24 float centered = (l-lmin)/(lmax-lmin)*
base;
37 float l =
log(fabs(x));
38 float centered = (l-lmin)/(lmax-lmin)*(
base-1);
39 int8_t
r=round(centered);
51 float l=lmin+
abs(i)/basef*(lmax-lmin);
53 if(i<0)
return -val;
else return val;
61 float l=lmin+
abs(i)/basef*(lmax-lmin);
64 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)
int8_t pack8logClosed(double x, double lmin, double lmax, uint8_t base=128)
Abs< T >::type abs(const T &t)
double unpack8logClosed(int8_t i, double lmin, double lmax, uint8_t base=128)
reverse of pack8logClosed