
On 9/11/06, Jason Hise <0xchaos@gmail.com> wrote:
I am trying to create a rational number class that does not break under overflow conditions, but just loses precision instead. While an overflow is detected I want to divide both numerator and denominator by 2 and keep trying. Also, I plan to support support infinity, negative infinity, and NaN (1/0, -1/0, and 0/0), so overflows which are really overflows for the rational type will result in these values.
you can download something pretty raw but already doing what you plan to do from www/ccg.hu/pub/src/rat check the comments at the beginning of bench1-op.cpp ... bench4-det.cpp to find out how does it compare to double (and boost::rational) there's a m$ project file included, on linux you can compile with g++ -Wall -I<boost-path> -O3 -DFXS bench1-op.cpp br, andras