Re: ELF detector

From: Spehro Pefhany (speffSNIP_at_interlogDOTyou.knowwhat)
Date: 09/26/04


Date: Sun, 26 Sep 2004 13:19:06 GMT

On Sun, 26 Sep 2004 09:38:15 +0100, the renowned John Woodgate
<jmw@jmwa.demon.contraspam.yuk> wrote:

>I read in sci.electronics.design that Ed Price <edprice@cox.net> wrote
>(in <q0v5d.74623$9Y5.54225@fed1read02>) about 'ELF detector', on Sun, 26
>Sep 2004:
>>
>>"John Woodgate" <jmw@jmwa.demon.contraspam.yuk> wrote in message
>>news:bkJTvRCl5mVBFwXa@jmwa.demon.co.uk...
>>>I read in sci.electronics.design that Ken Smith
>>> <kensmith@green.rahul.net> wrote (in <cj4o62$g7l$8@blue.rahul.net>)
>>> about 'ELF detector', on Sat, 25 Sep 2004:
>>>
>>>>I doubt software can do it. You need to divide by zero. Most
>>>>programmers have a hard time writing code that does that successfully.
>>>
>>> IF DIVISOR = 0, THEN RESULT = 1E+38 ELSE RESULT = DIVIDEND/DIVISOR
>>>
>>> It's the order in which you write it that matters. (;-)
>>> --
>>> Regards, John Woodgate, OOO - Own Opinions Only.
>>> The good news is that nothing is compulsory.
>>> The bad news is that everything is prohibited.
>>> http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
>>
>>
>>Precisely, solved in Basic, circa 1968!
>>Or in Fortran, even earlier!
>>That's how coders solve those pesky little "special cases". <g>
>>
>There's a bit more to it. My pseudocode produces an extreme outlier
>result, which the user really ought to pick up. It does NOT produce an
>error message that stops the program. Of course it can be extended to
>produce a *warning*. Stopping the program for a recoverable error is,
>IMHO, really rather stupid.

Note that you've arbitrarily chosen to use a very large positive
number for the result, even if the dividend is negative. I prefer math
that saturates in the appropriate direction. Sometimes, even with
division by zero errors, you can get it right. The sign tends to
matter quite a bit in control stuff.

Best regards,
Spehro Pefhany

-- 
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com


Relevant Pages

  • Re: ELF detector
    ... >>Or in Fortran, even earlier! ... My pseudocode produces an extreme outlier ... >error message that stops the program. ...
    (sci.electronics.design)
  • Was there a negative real zero possibility in early Fortran?
    ... 99 (WRITE ERROR MESSAGE) ... I already have found severe errors; one example is this original code ... I know this version was written for an IBM 360 in Fortran H (Fortran ... Is there any reason why the programmer is testing in some cases, ...
    (comp.lang.fortran)
  • Re: problem with unhandled exception (acces violation) and undefined array/pointer
    ... Fortran requires that the data type and kind, etc.) match that of the corresponding dummy argument in the routine being called. ... You are using Intel Visual Fortran which, by default, will warn you about such mismatches. ... My guess is that there is an error message, but it's in the console output window which is behind the debugger window. ...
    (comp.lang.fortran)
  • problem with function as argument of procedure
    ... I've been away from Fortran for a while, ... (I REALLY like the references to the standard in the error message; ... Perhaps I don't understand the error message well enough. ... because of the way internal procedures might be ...
    (comp.lang.fortran)