I have come to realize that I don't get the same result between iterations with increment and decrement. I get a slight difference when this math expression n + (1/(i^4))
iterates and adds a new value over itself 75+ times, being i
the number of the iteration. Under 75 iterations the result for each loop remains the same. Any ideas of why this is happening? This is the code I am running:
y=0
for i in 1:75
y = y + (1/(i^4))
end
print("final y value: ",y,"\n")
x=0
for i in 75:-1:1
x = x + (1/(i^4))
end
print("final x value: ",x,"\n")
And I got this for x and y:
final y value: 1.0823224592496965
final x value: 1.0823224592496967
But if i change the loop limits to 74 or less (74 in the following example), I get the same result for both loop:
final y value: 1.0823224276447583
final x value: 1.0823224276447583