Question: Why isn't my if statement working?

<p>I have the following code:</p>
<p> </p>
<p> for D5d_counter from 1 to 1000 do<br />
increment := 0.1:<br />
D5d_incr := initial_D5d + increment:<br />
D5d_decr := initial_D5d - increment:<br />
energy_D5d_init := energy1d(initial_D5d);<br />
energy_D5d_incr:= energy1d(D5d_incr);<br />
energy_D5d_decr := energy1d(D5d_decr);<br />
#evalM(cat("plot(",convert(P[1],string), ",",convert(P[2],string), ", '+')"))</p>
<p>#pointplot({[energy_D5d_init, initial_D5d]});<br />
if energy_D5d_incr > energy_D5d_init and energy_D5d_decr < energy_D5d_init then initial_D5d := D5d_decr;<br />
elif  energy_D5d_incr < energy_D5d_init and energy_D5d_decr > energy_D5d_init then initial_D5d := D5d_incr;<br />
else<br />
print("minima found");<br />
D5d_counter := 1000;<br />
fi;<br />
print(initial_D5d);<br />
D5d_counter;<br />
end do;<br />
 </p>
<p>Yet I reach a point where neither of the if conditions are fufilled, as follows:</p>
<p><br />
energy_D5d_init := -99978.49028<br />
energy_D5d_incr := 1.001364944*10^5<br />
energy_D5d_decr := -99820.61091</p>
<p>Yet the for loop carries on executing! What is going on? I am a maple newb so excuse if it's a really stupid question.</p>
<p> </p>
<p>Thank you</p>
Please Wait...