75 #define FIXEDPT_BITS 32 78 #if FIXEDPT_BITS == 32 83 #elif FIXEDPT_BITS == 64 91 #error "FIXEDPT_BITS must be equal to 32 or 64" 95 #define FIXEDPT_WBITS 16 98 #if FIXEDPT_WBITS >= FIXEDPT_BITS 99 #error "FIXEDPT_WBITS must be less than or equal to FIXEDPT_BITS" 102 #define FIXEDPT_VCSID "$Id$" 104 #define FIXEDPT_FBITS (FIXEDPT_BITS - FIXEDPT_WBITS) 105 #define FIXEDPT_FMASK (((fixedpt)1 << FIXEDPT_FBITS) - 1) 107 #define fixedpt_rconst(R) ((fixedpt)((R) * FIXEDPT_ONE + ((R) >= 0 ? 0.5 : -0.5))) 108 #define fixedpt_fromint(I) ((fixedptd)(I) << FIXEDPT_FBITS) 109 #define fixedpt_toint(F) ((F) >> FIXEDPT_FBITS) 110 #define fixedpt_add(A,B) ((A) + (B)) 111 #define fixedpt_sub(A,B) ((A) - (B)) 112 #define fixedpt_xmul(A,B) \ 113 ((fixedpt)(((fixedptd)(A) * (fixedptd)(B)) >> FIXEDPT_FBITS)) 114 #define fixedpt_xdiv(A,B) \ 115 ((fixedpt)(((fixedptd)(A) << FIXEDPT_FBITS) / (fixedptd)(B))) 116 #define fixedpt_fracpart(A) ((fixedpt)(A) & FIXEDPT_FMASK) 118 #define FIXEDPT_ONE ((fixedpt)((fixedpt)1 << FIXEDPT_FBITS)) 119 #define FIXEDPT_ONE_HALF (FIXEDPT_ONE >> 1) 120 #define FIXEDPT_TWO (FIXEDPT_ONE + FIXEDPT_ONE) 121 #define FIXEDPT_PI fixedpt_rconst(3.14159265358979323846) 122 #define FIXEDPT_TWO_PI fixedpt_rconst(2 * 3.14159265358979323846) 123 #define FIXEDPT_HALF_PI fixedpt_rconst(3.14159265358979323846 / 2) 124 #define FIXEDPT_E fixedpt_rconst(2.7182818284590452354) 126 #define fixedpt_abs(A) ((A) < 0 ? -(A) : (A)) fixedpt fixedpt_ln(fixedpt x)
char base
This version is stamped on May 10, 2016.
fixedpt fixedpt_sqrt(fixedpt A)
fixedpt fixedpt_log(fixedpt x, fixedpt base)
void fixedpt_print_file(fixedpt A)
fixedpt fixedpt_pow(fixedpt n, fixedpt exp)
fixedpt fixedpt_tan(fixedpt A)
void fixedpt_str(fixedpt A, char *str, int max_dec)
Convert the given fixedpt number to a decimal string.
fixedpt fixedpt_exp(fixedpt fp)
char * fixedpt_cstr(const fixedpt A, const int max_dec)
void fixedpt_print(fixedpt A)
fixedpt fixedpt_div(fixedpt A, fixedpt B)
fixedpt fixedpt_mul(fixedpt A, fixedpt B)
fixedpt fixedpt_sin(fixedpt fp)
fixedpt fixedpt_cos(fixedpt A)
x
Return the smallest n such that 2^n >= _x.