There is a CmoTime variable in which 0 is constantly being generated, although it should not seem to be CmoTime = TimeGenerator(true, OrderInterval, Precision); (For example, with such numbers OrderInterval = 0.06, Precision = 0.01). And here is TimeGenerator itself (Interval = 0.01, Precition (Tochnost) = 100)

 private double TimeGenerator(bool FirstOrder, double Tochnost, double Interval) { double NewTime; int GenerationInterval = (int)(Interval * Precition(Tochnost) + 1); // только если это не первая заявка if (!FirstOrder) { // исключение генерации нуля => повторяющееся время do { NewTime = (double)(rand.Next() % GenerationInterval) / Precition(Tochnost); } while (NewTime == 0); } else NewTime = (double)(rand.Next() % GenerationInterval) / Precition(Tochnost); return Math.Round(NewTime, ChisloZnakov(Tochnost)); } 
  • Did you rewrite the Precition function? - Igor
  • Yes, as they said - Alex
  • :) Is this the code that I wrote? - Igor
  • @Igor, by the way, if you remove the division by Precition (Tochnost), then it goes fine - Alex
  • @Igor, I apologize, I forgot. When I insert your code, the output goes "not a number", and it seems to work. Maybe not right, correct - Alex

1 answer 1

Your Precition function returns zero. My function Precition from the program stops working after the start of calculations can not return zero. But you commented out a throw in it, so it returns zero anyway.

Since Precition returns zero, GenerationInterval is one.

Since GenerationInterval is equal to one, rand.Next() % GenerationInterval will be zero.

Therefore, NewTime = 0/0; - "not a number".