Search code examples
overridingcomputer-sciencediscrete-mathematics

Functional Override: What occurs and when


So, functional override and discrete mathematics. A feature I'm not entirely sure of in critical system design. Say we have a feature where if f() should fail; g() would override; as denoted below...

"g() ⊕ f()"


  • x = 0.1;

  • f(x) x^2 when x ∈ ℕ1,

  • g(x) 2x -x when x ∈ ℕ0

I understand that in a situation where the input (x) isn't within the scope or domain of F(), then function G() is supposed to act as it's override and x will become a function of G(), g(x). But in the example above, you will notice that x is outside the domain of both f() and g().

So does this mean that the output is never given because x is an invalid input?

This seems unlikely to be a realistic exception to have to deal with in a critical system as one would expect "g() ⊕ f()" to be capable of compensating for any input; but in a recent examination, this kind of question was given to me and I found it to be quite the trick question. If anyone could shed some light on this, it would be much appreciated; None of my books mention anything about handling this kind of input and all of the example which have been taught to me have always been instances where x is within the range/domain of at least g().


Solution

  • So it turns out that even with g() overriding f(), if the input is outside of the range of both the first and overriding function; the output is an error as it never qualifies for either test. Similarly when we try to factorise a negative number using a calculator.