Hi all,
I am currently using FPC 2.6.4. and Lazarus 1.2.4. under Windows 7/64 on an Intel i5 430M (Westmere) core.
My project is about developing an arbitrary precision math library in Pascal (and optimized assembler). It looks like I will soon finish a first stable implementation of fundamental arithmetics and I am now looking for some guidance on how to best implement a class system for various number types. As I am pretty new to OO programming I thought I'd ask the experts what should be considered.
Here is the set-up
* there are several basic ordered number types that should be supported - natural, integer, rationals, reals, complex and quaternions
* only the first four are primitives, while for the complex and quaternions each component can be of one of the lower types. This means that for example a complex number must not neccessarily be a compound of two reals but it could also be a compound of two integers. This implies that in the first case all operations on complex numbers can be computed while in the later case e.g. sin(z) does not make sense and should yield a suitable response.
What I would like to come up with is a class system that supports the above described set-up and later on would allow for operator overloading to support easy use.
Sorry about the mathematical language above but I don't know how to express my ideas in a simple way otherwise. If the above is still intelligible please ask and I'll try my best to rephrase or explain different.
So, any takers with ideas how to define & structure a suitable class system?
Cheers,
MathMan