problem with pow() values . Arduino POW() vs Spreadsheet POWER()

I have a code that takes a sensor value from MPU6050 as absolutegyroX and applies pow(2,(absolutegyroX/31)); function to it.

However somehow when I test the arduino POW functions return values with a spreadsheet softwares POWER function they do not match. What am I missing here?

for example 59 yields 2 in Arduino code and 4 in Excel Spreadsheet.

SensorValue / Arduino Code / Excel Spreadsheet
70 3 5
78 3 6
78 3 6
89 3 7
70 3 5
59 2 4
33 2 2
59 2 4
96 7 9
132 15 19
181 31 57
227 127 160
122 7 15
105 7 10

and such.

Pasting entire code below:

/*

 *
 */



#include "FastLED.h"                                          // FastLED library.


////////////////////////////////////////////POTENTIOMETER
int pot1PinA0 = A7;
int pot1RAWValue  = 0;
const int numReadings1 = 10;
int readings1[numReadings1];      // the readings from the analog input
int index1 = 0;                  // the index of the current reading
int total1 = 0;                  // the running total
int average1 = 0;                // the average
int Pot1MappedOutputValue = 32;
////////////////////////////////////////////POTENTIOMETER////////////////////////////////////////////



////////////////////////////////////////////////SMOOTHING
/*
#include <movingAvg.h>
movingAvg avgGYRO(5);*/

int   rawValGyroX = 0;                       // sensor raw value
int   rawValGyroY = 0;                       // sensor raw value
int   rawValGyroZ = 0;                       // sensor raw value
float smoothedVal = 0.0;                // sensor smoothed value
float smoothStrength = 5;               // amount of smoothing (default 10)  

////////////////////////////////////////////////SMOOTHING/////////////////////////////////////////////////

////////////////////////////////////////////////MPU6050
#include <MPU6050_tockn.h>
#include <Wire.h>
MPU6050 mpu6050(Wire);
long timer = 0;
////////////////////////////////////////////////MPU6050/////////////////////////////////////////////////


////////////////////////////////////////////////FASTLED
uint8_t thishue = 0;                                          // Starting hue value.
uint8_t deltahue = 10;
#define LED_DT 3                                             // Data pin to connect to the strip.
#define COLOR_ORDER GRB                                       // It's GRB for WS2812B and BGR for APA102
#define LED_TYPE WS2812B                                       // What kind of strip are you using (WS2801, WS2812B or APA102)?
#define NUM_LEDS 300                                           // Number of LED's.
#define MAX_BRIGHTNESS 128      // Thats full on, watch the power!
#define MIN_BRIGHTNESS 1        // set to a minimum of 25%
struct CRGB leds[NUM_LEDS];                                   // Initialize our LED array.
////////////////////////////////////////////////FASTLED/////////////////////////////////////////////////

////////////////////////////////////////////////SETUP/////////////////////////////////////////////////

void setup() {
  Serial.begin(115200);
  Wire.begin();
  LEDS.addLeds<LED_TYPE, LED_DT, COLOR_ORDER>(leds, NUM_LEDS);        // Use this for WS2812B
  FastLED.setBrightness(MIN_BRIGHTNESS);



  mpu6050.begin();
  mpu6050.calcGyroOffsets(true);

 // TGAN_Potentiometer_1
  for (int thisReading1 = 0; thisReading1 < numReadings1; thisReading1++)
    readings1[thisReading1] = 0;
  // TGAN_Potentiometer_1
Serial.println("");
     Serial.print("Millis");
     Serial.print(" \t");
    Serial.print("absolutegyroX ");
    Serial.print(" \t");
     Serial.print(" BrightnessValue  ");
        
    
}////////////////////////////////////////////////SETUP/////////////////////////////////////////////////



////////////////////////////////////////////////LOOP/////////////////////////////////////////////////
void loop() {

 unsigned long curMillis = millis();          // Get current time. to have a sense of sampling rate. 5 digits. First 2 digits are seconds...
 
  mpu6050.update();


  pot1RAWValue  = analogRead(pot1PinA0);
  
   // TGAN_Potentiometer_1
  total1 = total1 - readings1[index1];
  readings1[index1] = pot1RAWValue;
  total1 = total1 + readings1[index1];
  index1 = index1 + 1;
  if (index1 >= numReadings1)
    index1 = 0;
  average1 = total1 / numReadings1;


  Pot1MappedOutputValue = map(average1, 5, 780, 24, 40);
  // TGAN_Potentiometer_1

 /*
 int oldPot1MappedOutputValue;
  if (Pot1MappedOutputValue != oldPot1MappedOutputValue) 
  {
    Serial.print("pot1RAWValue : "); Serial.print(pot1RAWValue ); Serial.print(" / Pot1MappedOutputValue: "); Serial.println(Pot1MappedOutputValue);
  }
  oldPot1MappedOutputValue = Pot1MappedOutputValue;
*/

/*
//if (millis() - timer > 10) {

    Serial.print("&temp &");Serial.print(mpu6050.getTemp());
    Serial.print("&accX & ");Serial.print(mpu6050.getAccX());
    Serial.print("&taccY& ");Serial.print(mpu6050.getAccY());
    Serial.print("&taccZ & ");Serial.print(mpu6050.getAccZ());
  
    Serial.print("&gyroX & ");Serial.print(mpu6050.getGyroX());
    Serial.print("&tgyroY & ");Serial.print(mpu6050.getGyroY());
    Serial.print("&tgyroZ& ");Serial.print(mpu6050.getGyroZ());
  
    Serial.print("&accAngleX & ");Serial.print(mpu6050.getAccAngleX());
    Serial.print("&taccAngleY & ");Serial.print(mpu6050.getAccAngleY());
  
    Serial.print("&gyroAngleX & ");Serial.print(mpu6050.getGyroAngleX());
    Serial.print("&tgyroAngleY & ");Serial.print(mpu6050.getGyroAngleY());
    Serial.print("&tgyroAngleZ& ");Serial.println(mpu6050.getGyroAngleZ());
    
    Serial.print("&angleX & ");Serial.print(mpu6050.getAngleX());
    Serial.print("&tangleY & ");Serial.print(mpu6050.getAngleY());
    Serial.print("&tangleZ &");Serial.print(mpu6050.getAngleZ());
   
    
 //   timer = millis();  }

*/
rawValGyroX = mpu6050.getGyroX();
int absolutegyroX = abs(rawValGyroX);
int BrightnessValue = pow(2,(absolutegyroX/31)); //Calculates the value 2 raised to (absolutegyroX/5). Pow() //pow(2,absolutegyroX/5);


Serial.print(curMillis); Serial.print(" \t");Serial.print(" \t"); Serial.print(" \t"); // Get current time. to have a sense of sampling rate. 5 digits. First 2 digits are seconds...
Serial.print(absolutegyroX); Serial.print(" \t");Serial.print(" \t"); Serial.print(" \t");
Serial.print(BrightnessValue);Serial.print(" \t");Serial.print(" \t"); Serial.println(" \t");


  EVERY_N_MILLISECONDS(5) {                           // FastLED based non-blocking routine to update/display the sequence.
    rainbow_march();
  }
  show_at_max_brightness_for_power();

  FastLED.setBrightness(BrightnessValue);

}


////////////////////////////////////////////////LOOP/////////////////////////////////////////////////


void rainbow_march() {                                        // The fill_rainbow call doesn't support brightness levels
                                              
  fill_rainbow(leds, NUM_LEDS, thishue, deltahue);
//  addGlitter(300);// Use FastLED's fill_rainbow routine.
} // rainbow_march()

/*
void addGlitter( fract8 chanceOfGlitter)
{
  if ( random8() < chanceOfGlitter) {
    leds[ random16(NUM_LEDS) ] += CRGB::White;
  }
}*/

Integer division of absolutegyroX/31 won't produce the same result as in Excel which uses floating point division.
Try
absolutegyroX/31.0

Pete

thank you that was it!