user10604: I write a piece of code in online GDB using c++, the code calculates some coefficients for a IIR filter which tries to approximate a fractional derivative and integral for a fractional PID control. The code works as expected in the online IDE, but when I try to execute it in a Arduino Due, the results and only overflows and nan, and really don't know what's the problem so, 
Here is the code in GDB online https://onlinegdb.com/rycwt62XL which gives the expected results: 
Array A, Array B
1.41421,1
-0.707107,0.5
-2.12132,-1.5
0.883883,-0.625
0.883883,0.625
-0.265165,0.1875
-0.0883883,-0.0625
0.0110485,-0.0078125
And here is the code for the Arduino Due, which only change the printing method using the serial commands, https://onlinegdb.com/ByAs5xyVU, and the results are: 
Array A, Array B
ovf,1.00
ovf,ovf
ovf,0.00
inf,ovf
ovf,0.00
inf,ovf
ovf,3.89
inf,ovf
And really don't know where to start for fix this results, thanks. The Method is  exactly the same. 

user4143: I can't find the root cause of the problem - it's probably because the Due is possibly the worst board that Arduino ever made, and the compiler / linker / support libraries barely work at the best of times.
However, some things you need to look at in your code:
    double* h = new double[L]; 
    for(int n = 0; n <= L; n++){
        for(int k = 0; k <= n; k++){
            h[n] += pow(operador,-alpha-n+k)*pow(1.0-operador,n-k)*Binomial_E(alpha,k)*Binomial(-alpha,n-k);
        }
    }

There you allocate L (15) doubles in an array. But then you go on to access array slices 0-15. That's 16 entries in an array of size 15, so you're overflowing it and corrupting other memory.
Also you have no delete to balance the new, so you have a memory leak.  You would be better using:
double h[L+1];

instead of new.

10604: <p>I write a piece of code in online GDB using c++, the code calculates some coefficients for a IIR filter which tries to approximate a fractional derivative and integral for a fractional PID control. The code works as expected in the online IDE, but when I try to execute it in a Arduino Due, the results and only overflows and nan, and really don't know what's the problem so, </p>

<p>Here is the code in GDB online <a href="https://onlinegdb.com/rycwt62XL" rel="nofollow noreferrer">https://onlinegdb.com/rycwt62XL</a> which gives the expected results: </p>

<p>Array A, Array B</p>

<p>1.41421,1</p>

<p>-0.707107,0.5</p>

<p>-2.12132,-1.5</p>

<p>0.883883,-0.625</p>

<p>0.883883,0.625</p>

<p>-0.265165,0.1875</p>

<p>-0.0883883,-0.0625</p>

<p>0.0110485,-0.0078125</p>

<p>And here is the code for the Arduino Due, which only change the printing method using the serial commands, <a href="https://onlinegdb.com/ByAs5xyVU" rel="nofollow noreferrer">https://onlinegdb.com/ByAs5xyVU</a>, and the results are: </p>

<p>Array A, Array B</p>

<p>ovf,1.00</p>

<p>ovf,ovf</p>

<p>ovf,0.00</p>

<p>inf,ovf</p>

<p>ovf,0.00</p>

<p>inf,ovf</p>

<p>ovf,3.89</p>

<p>inf,ovf</p>

<p>And really don't know where to start for fix this results, thanks. The Method is  exactly the same. </p>
 4143: <p>I can't find the root cause of the problem - it's probably because the Due is possibly the worst board that Arduino ever made, and the compiler / linker / support libraries barely work at the best of times.</p>

<p>However, some things you need to look at in your code:</p>

<pre><code>    double* h = new double[L]; 
    for(int n = 0; n &lt;= L; n++){
        for(int k = 0; k &lt;= n; k++){
            h[n] += pow(operador,-alpha-n+k)*pow(1.0-operador,n-k)*Binomial_E(alpha,k)*Binomial(-alpha,n-k);
        }
    }
</code></pre>

<p>There you allocate <code>L</code> (15) doubles in an array. But then you go on to access array slices 0-15. That's 16 entries in an array of size 15, so you're overflowing it and corrupting other memory.</p>

<p>Also you have no <code>delete</code> to balance the <code>new</code>, so you have a memory leak.  You would be better using:</p>

<pre><code>double h[L+1];
</code></pre>

<p>instead of <code>new</code>.</p>
