Question: Here is my sqrt function. I want to output the double value with specific precision. 
But I was getting this output: "the sqrt of 0.5 is: 0.7071069999999999 " 
The odd thing is, when I was debugging, the longResult is 707107

```
public static double precision = 0.000001;

// the main sqrt function using binary search
public static double Cal(double input){
    if(input < 0) return -1;
    if(input == 0 || input == 1) return input;

    // the sqrt value shall be between 0 ~ input. we use 二分法 to search for the value;
    double min = 0;
    double max = input;
    if(input < 1) {
        min = input;
        max = 1;
    }

    double mid = 0;

    while(max - min > precision){
        mid = (min + max) / 2;
        if(mid * mid == input) return mid;
        else if(mid * mid < input) min = mid;
        else max = mid;
    }
    long longResult = (long)((max + min) / 2 / precision);
    return longResult * precision;
}

public void Test(){
    double input = 0.5;
    System.out.println(String.format("the sqrt of %s is: %s", input,Sqrt.Cal(input)));
}

```

Answer: 
use the jquery tags in between PHP Like below-

```
<?php
    PHP CODE
?>
<script>
    JQUERY CODE
</script>

<?php    
PHP Code
?>

```
```
echo <<<SCRIPT
<script>
$('#data').append(results);

</script>
SCRIPT;

```