Scriveva Jonah Thomas lunedė, 03/03/2008:
> I ask you to think about that a little more.
>
> You have two outcomes, execute WORD1 or extecute WORD2.
>
> You have a bug that you don't know about, where the test that's supposed
> to tell you whether to use WORD1 or WORD2 gives you a wrong answer or
> the test is bypassed and you're getting a random value as the test
> result. Your response is to force the use of WORD1 if the wrong test
> result is a negative number, and force the use of WORD2 if the result is
> a positive number that's out of range, and do nothing to tell you
> there's any error.
>
> That might be a good approach in the short run, sometimes. Maybe you're
> collecting a thousand samples a second to do statistics on and one time
> out of 100,000 you do the wrong thing, and it doesn't really matter. The
> result is that 0.001% of your data is wrong, and the problem will likely
> be lost in the noise. Your users won't notice, you won't notice,
> everybody's happy. It isn't good but frankly your users will be happier
> than they would if you told them there was a problem they had to deal
> with. On the other hand, if one time in 100,000 your program fires an
> armed missile when it shouldn't....
>
> Wouldn't you like to find out about the problem and choose what to do
> about it? Sometimes that's im****tant. Far better to fix the problem than
> just choose WORD2 and forget it.
>
> here's a more complicated way to do it:
>
> T-JUMP ( *ix base-address item -- *jx)
> 1+ 0 MAX 3 MIN CELLS + @[EMAIL PROTECTED]
EXECUTE ;
>
> CREATE SEL_WORD ' BOUNDS-UNDERFLOW , ' WORD1 , ' WORD2 , '
> BOUNDS-OVERFLOW ,
>
> .... SEL_WORD TEST T-JUMP
>
> So if you have a bounds error you execute either BOUNDS-UNDERFLOW or
> BOUNDS-OVERFLOW which presumably will *tell* you about it. If you want
> you can have it tell you about the problem and then execute WORD1 or
> WORD2 so the system doesn't stop functioning. Or discard the data and
> wait for the next signal. Or whatever you think ahead of time is best
> after the undiscovered error. But if the error is there you probably
> want to find out about it, right?
What to say...
Thanks again!
It's very nice the hint 1+ 0 MAX 3 MIN CELLS + @[EMAIL PROTECTED]
in order to
find the error and execute BOUNDS-OVERFLOW ;-)
--
Su msn: sbi82 chiocciola hotmail punto it
Non c'č cattivo pių cattivo di quando un buono diventa cattivo! (Bud
Spencer)
Ciao da Stefano


|