I'm going through a topology book (Introduction to Topology by Bert Mendelson.) In one of the first chapters the author defines continuity in an epsilon-delta manner (not limit definition.) Here is the definition:

I'm confused because, if I understand correctly, we can set both [tex]\epsilon[/tex] and [tex]\delta[/tex] to be any numbers. Consider for example this function:

[tex]f(x) =\begin{cases}
1 & \text{ if } floor(x) \text { is odd } \\
2 & \text{ if } floor(x) \text{ is even }
\end{cases}[/tex]

With 0 considered even. If we let [tex]\epsilon = 98^{8000}[/tex], then this function is continuous, as all [tex]f(x)[/tex] are within [tex]\epsilon[/tex] of eachother.

So what the heck, man? Is this a "weak" definition? Can a function be "continous" even if it is disconnected? What am I misunderstanding?

You cannot "set" epsilon and delta to be any number like you say.
What you do to prove continuity is you set epsilon to be a certain number, and then, depending on the function of interest, you must show that there exists a delta such that x's within a distance delta of a yield f(x)'s within a distance epsilon of f(a). And you must be able to find such a delta for each particular choice of epsilon. Delta is dependant on epsilon, not independant of it.

For instance in your exemple, the function is continuous everywhere except at the integers where it jumps one unit. If n is an integer and epsilon=1/2, you certainly cannot find a delta such that |f(x)-f(a)|<1/2 as soon as |x-a|<delta.

The standard wording for the epsilon-delta definition is a bit confusing, in addition to the definition being genuinely difficult to grasp. Some things to keep in mind:
* The epsilon is bound with a "forall" qualifier on the outside. The delta is bound with an "exists" quantifier on the inside. This means that delta can depend on epsilon. (In fact it almost always does). So most proofs will take the form: delta equals some function of epsilon.
* The "whenever" bit, to me at least, always sounded really strange. It's a BACKWARDS implication (in logical symbols, it would be '<='). Usually, when I write the definition, I swap the order of the inequalities: "whenever blah < delta, blah < epsilon."
* Alternatively, you can think of "whenever" as meaning "or if not". So, "blah < epsilon whenever blah < delta" becomes "blah < epsilon or blah >= delta."
* The topological definition is much easier to use! A function f is continuous if for any open set S, f^-1(S) is open.

Also, intuitively, you can think of epsilon as the "error tolerance on the output" and delta as the "error tolerance of the input." What the epsilon-delta definition means is something like "If you need a sufficiently accurate output, you need to provide sufficiently accurate input."