ELF detector

Sep 25, 2004 29 Replies

[...]

When you go to normalize the gain of the induction loop at zero Hz, you have to write some very tricky software. You have to divide by zero to get any sensitivity you want. Most programmers would have trouble designing a divide by zero routine that is accurate to more than 1 bit.

You could use a GMR or other magnetoresistive device.

-- kensmith@rahul.net forging knowledge

ROSIVID/DNEDIVID = TLUSER ESLE 83+E! = TLUSER NEHT .0 = ROSIVID FI

Would yeld a different result but you haven't successfully divided by zero since the logic of your code avoids the divide completely if the DIVISOR is zero.

There is a trick you can use in C++ to do it. C++ allows all operators to be overloaded. Thus in C++ you can make up you own rules about ADD, SUBTRACT, MULTIPLY and DIVIDE to that 1/0 is perfectly legal.

In C++ you can make the main part of your program:

int main(void){ return 1/0; }

-- kensmith@rahul.net forging knowledge

I read in sci.electronics.design that Ken Smith wrote (in ) about 'ELF detector', on Sun, 26 Sep 2004:

Perfectly valid code in HSILGNE.

of course, because N/0 is mathematically nonsense, so it *can't* be evaluated rigorously.

Is that essentially different from my pre-emptive *redefinition* of N/0 as '= 1E38'?

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

[...]

A few differences:

(1) What you showed could be figured out by the maintainers. The C++ version can easily be written so that no-one can understand it.

(B) The version you did is discontinuous near zero. In C++ you can redefine the divide so that X/Y cos(X/Y) yelding a nice smooth curve near zero.

(iii) The 1E38 is machine dependant.

(d) C++ is coded in lower case.

-- kensmith@rahul.net forging knowledge

Reply to option (d): That is because the programmers are too damn lazy to use mixed case.

I read in sci.electronics.design that Ken Smith wrote (in ) about 'ELF detector', on Sun, 26 Sep 2004:

I agree that is the whole justification for the use of C++ for anything.

But you often don't want to *disguise* the 'divide by zero' because it indicates a problem further up the code. Also, how can replacing, say,

136/0 by cos(136/0) = ?? make a smooth curve when the adjacent points are cos(135/0.001) = 0.87 and cos(137/-0.003) = 0.89?

So, replace by the outlier of your choice (or the one dictated by your genes and memes).

Oh, well, you're obviously completely right, then. That's an

*****ESSENTIAL**** difference.
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
[...]

Ken, my math is shaky at best, especially near infinity. Wouldn't cos(X/Y) give an infinite number of zero crossings as X0 and Y-->0?

Best Wishes,

Mike Monett

[...]

You are right. I messed up. I should have written something like cos(X+Y)

The whole point of C++ is information hiding isn't it? You want to hide as much information as you can spread over about 50 *.h files so the maintainer has no hope of finding the bugs.

This is part of the reason why there is much more code reuse in the Fortran community than the C++ one.

-- kensmith@rahul.net forging knowledge

Your seems to be better than mine were at that moment in time. Yes I messed up on that one.

-- kensmith@rahul.net forging knowledge

just need a fraction byte :)

Ken Smith wrote:

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required