
Dear Markus and Ingo,
we have a problem with CoStLy 0.2. Basically, pow(x, y) throws an exception when we believe it should not. Here is what happens. First, we invoke CoStLy's pow():
128 aci = pow(base_aci, exponent_aci); (gdb) print base_aci $1 = { real_part = { INF = -0.73205080756888341, SUP = -0.73205080756887086 }, imag_part = { INF = 0, SUP = 0 } } (gdb) print exponent_aci $2 = { real_part = { INF = -1, SUP = -1 }, imag_part = { INF = 0, SUP = 0 } }
We are now in CoStLy's pow(), at line 2719 of cimath.cpp, which reads
2719 return exp(n*ln(bas));
(gdb) print n $3 = (const cinterval &) @0xbfffe740: { real_part = { INF = -1, SUP = -1 }, imag_part = { INF = 0, SUP = 0 } } (gdb) print bas $4 = (const cinterval &) @0xbfffe7e0: { real_part = { INF = -0.73205080756888341, SUP = -0.73205080756887086 }, imag_part = { INF = 0, SUP = 0 } }
We now hit lines 1367 and 1368 of cimath.cpp, where the exception is thrown:
1367 if( (srez <= 0)&&(im_min==0) )//Argument intersects negative real axis. 1368 throw function_not_defined();
What is the recommended way out of this problem? I mean, on the one hand we could say this is a bug in CoStLy: a function_not_defined() is thrown when the function is defined. On the other hand, your position may rightfully be that it is the duty of the client code to only call pow() in a certain way. What is your position? All the best
Roberto
P.S. If you are curious about what we are doing, please see http://www.cs.unipr.it/purrs/. The project is at a very early stage, but you should get an idea of what it is about.