dim y as double, yd as double, dx as double, x as double
と
loop until math.abs(dx) < eps
の2文は何を意味しているのですか?