OONumerics User :

From: Kasper Peeters (kasper.peeters_at_[hidden])
Date: 2007-07-24 10:16:08


I am looking for a C or C++ library which will allow me to do simple
arithmetic (addition, subtraction, multiplication and division only)
with expressions containing square roots of integers, keeping the
square roots as exact objects. So I want that e.g.

   ( 1 + sqrt(2) ) * ( 1 + sqrt(6) )

gets simplified to

   1 + sqrt(6) + sqrt(2) + 2 sqrt(3)

or
 
   1 + sqrt(2) sqrt(3) + sqrt(2) + 2 sqrt(3) ,

keeping the sqrt's instead of approximating them with floats.

It's not terribly hard to write, but perhaps someone knows about an
existing library that does this for me?

Cheers,
Kasper