I didn't mean to dispute your anaysis. I think it is correct and I understood it exactly in the way suggested by your diagram.
> The short answer is the both Andrew and I have tried +=1 and it doesn't work.
It cannot work if you convert using trunc, which is the default "cast" conversion between float and int.
> In this case the float to int conversion floor(D/T)==0. So +=1 gives a delay of 1. This will wait until the next tick (time A) which is almost zero.
I was proposing to use ceil. This will result in 1, except if the input is exactly 0.0.
I didn't mean to dispute your anaysis. I think it is correct and I
understood it exactly in the way suggested by your diagram.
> The short answer is the both Andrew and I have tried +=1 and it
doesn't work.
It cannot work if you convert using trunc, which is the default "cast"
conversion between float and int.
> In this case the float to int conversion floor(D/T)==0. So +=1 gives a
delay of 1. This will wait until the next tick (time A) which is almost
zero.
I was proposing to use ceil. This will result in 1, except if the input
is exactly 0.0.