<p>Is there any feasible way of using generics to create a Math library that does not depend on the base type chosen to store data?</p>

<p>In other words, let's assume I want to write a Fraction class. The fraction can be represented by two ints or two doubles or whatnot. The important thing is that the basic four arithmetic operations are well defined. So, I would like to be able to write <code>Fraction&lt;int&gt; frac = new Fraction&lt;int&gt;(1,2)</code> and/or <code>Fraction&lt;double&gt; frac = new Fraction&lt;double&gt;(0.1, 1.0)</code>.</p>

<p>Unfortunately there is no interface representing the four basic operations (+,-,*,/). Has anybody found a workable, feasible way of implementing this?</p>

First, your class should limit the generic parameter to primitives ( public class Fraction where T : struct, new() ).
Second, you'll probably need to create
implicit cast overloads
so you can handle casting from one type to another without the compiler crying.
Third, you can overload the four basic operators as well to make the interface more flexible when combining fractions of different types.
Lastly, you have to consider how you are handling arithmetic over and underflows.  A good library is going to be extremely explicit in how it handles overflows; otherwise you cannot trust the outcome of operations of different fraction types.