[Newbie]Converting pulses to volume.

Hi everyone, I really need ur help in one part of the project I'm working on.

I have to convert the number of pulses a agricultural fertilizer machine gives me (I've already done the pulses counter sketch) into a volume of fertilizer (I have the quadratic equation wich is Y = (2E-05)*x^2 + 0.0017x - 0.0338 )

My question is: how could I write the code for having one variable input (the number of pulses ,the X on the equation, will be changing for every position of the machine) and have the result (Y) printed on the serial port.

I founded some codes, like this one,

void setup()
{  
    Serial.begin(9600);
}


void loop()
{

  float result=0;
   for (float x=0; x <= 256; x++ ){

     
result = (0.00002 * pow(x,2))  + (0.0017 * x) -0.0338;

Serial.print(x);
Serial.print(" - ");
Serial.print(result);
Serial.println(" ");


delay(1000);

   } 
}

for solving equations but the x is not declared as an input...

<<<sorry for my bad english, hope you could help me...Thanks!>>>

pow(x,2)

That's a pretty expensive and inaccurate way to get x * x.

   for (float x=0; x <= 256; x++ ){

Using float as a loop index is generally NOT a good idea.

for solving equations but the x is not declared as an input...

But, that makes NO difference.

Thanks PaulS for your help! I'll change those things, but what I need to know is how to declare the x as the number of pulses that the counter i made (This one, using the Encoder.h library and modifying it)

volatile int unsigned pulsos=0;
#include <Encoder.h>

Encoder myEnc(2, 6);


void setup() {
  pinMode (13,INPUT);
  Serial.begin(9600);
  Serial.println("Basic Encoder Test:");
}

long oldPosition  = myEnc.read();

void loop() {
  long newPosition = myEnc.read();
  if (newPosition != oldPosition) {
    oldPosition = newPosition;
    if (digitalRead (13)){    //when pin 13 is HIGH INCREASE
       pulsos--;}
    else{              //when pin 13 is LOW DECREASE
       pulsos++;}
    Serial.println(pulsos);    
       
}
}

is sending to me(where the X are the number of pulses) for solving the equation and print the result .

Could you help me?

but what I need to know is how to declare the x as the number of pulses that the counter i made

Why? There is nothing magic about the name x.

   float result = (0.00002 * pulsos * pulsos)  + (0.0017 * pulsos) - 0.0338;