Silverfrost Forums

Welcome to our forums

negative number raised to non integer power

13 Nov 2015 10:38 #16997

Hi - short story is the Win10 upgrade got stuck in an endless auto-repair loop, had to rebuild my PC to win 7 again. Reinstalled SilverFrost - but a program that ran without error before, now fails with 'negative number raised to non integer power' error.

I am pretty sure I haven't changed the program since I last ran it before the rebuild/reinstall!

So is there a setting I might have forgotten? Code where it fails is below, alfa = 0, n=4 fails on the term4 calc - I fixed it with making the power 2 and not 2.0 - but I'm sure it was 2.0 before ....

	    !----- Find KE NxN matrix ----  
        do i=1, n		! rows
    	do j=1, n	! cols
        	If (i.eq.j) then
            	term1 = -1.0/12.0
                term2 = (((2.0*n)+alfa+1.0)*(alfa+4.0))/(6.0*(alfa+1.0)*x(i))
                term3 = ((alfa+2.0)*(alfa-5.0))/(6.0*(x(i)**2.0))
	        T(i,i) =  term1+term2+term3 
            else
              	term1 = ((-1)**(i-j))/(sqrt(x(i)*x(j)))
                term2 = (n/(alfa+1.0)) + (1.0/2.0)
                term3 = (1.0/x(i))+(1.0/x(j))
                term4 = (x(i)+x(j))/((x(i)-x(j))**2.0)
              	T(i,j) = term1*(term2 - term3 + term4)
            end if 
		end do
    end do

Thanks

14 Nov 2015 7:55 #16999

You did not provide a definition of x(4), but I could reproduce your problem.

Changed '**2.0' to '**2' and the problem went away with my assumed x.

Could it be a change in FTN95 than **2.0 is no longer changed to **2 (assuming this was once the case, as I do remember this being discussed before.)

John

Please login to reply.