#include <math.h>

float ParamQuantize(float value, float quantization)
{

	float result = 1.0;
	float k = (float) ceil(value / quantization);
	
	if ((k*quantization) < 1.0)
		result = k*quantization;

	return result;
}

float norm2quant(float minparm, float maxparm, float quant, float x)
{
	int y;
	float step = (maxparm-minparm);

	y = (int)minparm + (int)quant * (int)((0.5 + x*step)/quant);

	return (float)y;
}

float quant2norm(float minparm, float maxparm, float y)
{
	return (y-minparm)/(maxparm-minparm);
}
