ADXL functions

Hi,

I am working with ADXL345 sensor and the Sparkfun library.

I have some questions about the library…

Here is the code

/*************************** RATE BITS ******************************/
/*                                                                  */
double ADXL345::getRate(){
	byte _b;
	readFrom(ADXL345_BW_RATE, 1, &_b);
	_b &= B00001111;
	return (pow(2,((int) _b)-6)) * 6.25;
}

void ADXL345::setRate(double rate){
	byte _b,_s;
	int v = (int) (rate / 6.25);
	int r = 0;
	while (v >>= 1)
	{
		r++;
	}
	if (r <= 9) { 
		readFrom(ADXL345_BW_RATE, 1, &_b);
		_s = (byte) (r + 6) | (_b & B11110000);
		writeTo(ADXL345_BW_RATE, _s);
	}
}

1.- In the funcion geRate, what does “(pow(2,((int) _b)-6)) * 6.25” do? I could not understand it…

2.- In the funciton setRate:

2.1.- Why do I do " int v = (int) (rate / 6.25)"??

2.2.- In general, I can understand anything about that from int r=0…

Thank you for your help.

Best regards,

Luis