Lines 11 and 12 : Always initialise your variables to something - it's one of the biggest source of error for young and old :+)
Line 27: Don't use doubles in a for loop, or any other end condition. They are not represented exactly, and could give you off by one errors. There are lots of numbers including whole numbers that don't convert exactly to their double counterparts. For example 20 might be 20.0 +/- 3e-16. If it is a shade less than 20, you will get an extra iteration in your for loop. Instead, calculate how many times you need to loop, as an int, then use that value in the for loop.
CONST is not a particularly good variable name IMO.