Question: I'm making a REST call and receiving this XML back:

```
<replacement><![CDATA[this is &amp; ampersand]]></replacement>

```

I've substringed out the bit that I really care about:

```
this is &amp; ampersand

```

How do I now decode this snippet into (I'm not using yaws):

```
this is & ampersand

```

Answer: 
It's most likely because of the integer cast. Depending on your inputs, the results can be close and appear to have the same result because of rounding during the integer cast. Use double in your function instead.
To get accurate result, you need `float` or `double` type.

Please try this:

```
#include <stdio.h>
#include <math.h>

double PI = 3.14;

double flowRateFormula(float, float);   

double flowRateFormula(float pipeDiameter, float velocity)
{
    double p = pow(pipeDiameter, 2);
    double result = 0.25 * PI * p * velocity;
    return result;
}

int main()
{
    double flowRate;
    float velocity;
    float pipeDiameter;

    printf("Enter velocity of liquid(in./s):");
    scanf("%f",&velocity);
    printf("Velocity=%f in/s.\n",velocity);

    printf("Enter pipe diameter(inches):");
    scanf("%f",&pipeDiameter);
    printf("Pipe Diameter=%f inches.\n",pipeDiameter);

    printf("Applying formula for Flow Rate.........\n");
    flowRate=flowRateFormula(pipeDiameter,velocity);

    printf("Pipe Diameter=%f inches.\n",pipeDiameter);
    printf("Velocity of liquid=%f in/s.\n",velocity);
    printf("Thus, the flow rate=%f ft/s.\n",flowRate);

    return 0;
}

```

Output:

```
$ ./a.out 
Enter velocity of liquid(in./s):10
Velocity=10.000000 in/s.
Enter pipe diameter(inches):20
Pipe Diameter=20.000000 inches.
Applying formula for Flow Rate.........
Pipe Diameter=20.000000 inches.
Velocity of liquid=10.000000 in/s.
Thus, the flow rate=3140.000000 ft/s.
$ 
$ 
$ 
$ 
$ ./a.out 
Enter velocity of liquid(in./s):12.34
Velocity=12.340000 in/s.
Enter pipe diameter(inches):435.345
Pipe Diameter=435.345001 inches.
Applying formula for Flow Rate.........
Pipe Diameter=435.345001 inches.
Velocity of liquid=12.340000 in/s.
Thus, the flow rate=1835912.361516 ft/s.
$ 

```

Hope this helps!