By sampling the previous temperature at a different rate than the current temperature, you're making time a variable. Previously, time was a variable, but it took relatively the same amount of time for the loop to complete, so the variable time could be neglected.

This if statement:

`if ( (celsius >= lasttemp - 00.10) && (celsius <= lasttemp + 00.10) `

does not take into account how long it has been since lasttemp was sampled. If you want to calculate the derivative, you need to take into account time. The easiest way to do this, would be to every X amount of time, calculate the difference in temperature and call it delta. delta divided by X seconds will give you the rate of change (derivative). If its under a certain amount, then its stable.