Zorro wrote on Sep 17th, 2015, 10:59am:Hi boe,
thanks for your reply.
Your suggestions partly solves the problem. To understand it properly could you please tell me what you mean when you say "Accumulation of numerical errors" ???
If I use value=49.995m as you suggests it works fine, as expected. See Picture 2.
But the question is: how do I know when I need to subtract that small delta from my threshold value???
As an example, if I use value=60m it works fine, without needing to subtract any delta. See Picture 3.
Thank you.
Zorro.
Zorro,
the simulator (usually) uses a binary representation for numbers, and the binary representation of 1m is infinite. Therefore, numerical errors occur and propagate through your calculation.
You may want to try the following (pseudo-)code
Code:sum = 0
for i = 1 to 10000
sum = sum + 1m
print i, ": ", sum - 0.001*i
- B O E