Divisors of rational functions on curves at singular points

Suppose $C$ is an algebraic curve (which has singular points) over an algebraically closed field $k$, and that $f$ is a rational function on $C$. How does one defines the Weil divisor of $f$?

The problem is that the local rings of $C$ at singular points are not DVR's, so I do not have an obvious candidate for an order at a point.

Thanks!

Edit: Let me give an example, inspired by an answer from below. Suppose $C$ is curve $y^2=x^3$. What would be the order of the rational function $x/y$ at the origin?

-

You can define the "order" of a regular function at a point $x$ to be the length of the quotient: $\mathcal O_{X,x}/(f)$ (which will be Artinian, so has finite length). You can probably find the details in Hartshorne's book or Fulton's "Intersection theory".

Details added: here is a sketch that this is well-defined: Suppose your rational function can be represented by $f/g$ and $f'/g'$ at the stalk, which I will call $R$. $R$ is one-dimensional domain (you can assume less, but let's make it simple). We know $f/g =f'/g'$ and want to prove $l(R/fR) - l(R/gR) = l(R/f'R) - l(R/g'R)$ or $$l(R/fR) + l(R/g'R) = l(R/f'R) + l(R/gR)$$

Since $fg' = f'g$, we are done by the following general fact:

$$l(R/abR) = l(R/aR) + l(R/bR)$$

Hint: look at the sequence $0 \to aR/abR \to R/abR \to R/aR \to 0$

PS: One can also give a definition by using the normalization of $X$, but I think the above is more down-to-earth and computable, if less sexy.

-
But by writing this you assume that $f \in \mathcal O_{X,x}$, which need not be the case. Is $\mathcal O_{X,x}$ a valuation ring so we can assume that either $f$ or $1/f$ is in it? – the L Mar 3 '11 at 8:12
For example, let $C$ be $Y^2=X^3$. Looking at the function $x/y$ at the origin, what is it order there? I can calculate the order of $x$ and $y$ and substract, but is this well defined and does not depend on the choice of polynomials representing the function near the origin? – the L Mar 3 '11 at 8:46
@anonymous: please see the edit. – curious Mar 3 '11 at 15:17