Generation

generate functionWed, 07 Dec 2022

floating point to fixed point conversion

float float2fix(float x, int bits, int frac_bits) { float scale = pow(2, frac_bits); float res = x * scale; return res; }

Questions about programming?Chat with your personal AI assistant