[ADOL-C] Arithmetic Exception

Kshitij Kulshreshtha kshitij at math.upb.de
Tue Nov 2 08:19:16 EDT 2010

Hello Manuel,

As on 2010-11-02 11:15, Kudruss did write:
> Hey there,
> I try to use ADOLC for OED in robotics, but using code generated with
> adoubles cause an Arithmetic Exception. With normal doubles the program
> works fine. Problem occurs in using the implemented atan2 function. 
> Greetings,
> Manuel Kudruss
> Here's a small example where the error appears.

Your observation is correct. Unfortunately there is no good workaround
for this. If you don't enable the arithmetic exceptions via
feenableexcept() then you will get the correct answer (clRPY = -pi) and
the derivative later. ADOL-C needs to check all the branches of atan2
for given arguments and store the results on the tape, which is why in
one of the branches a divide by zero happens.

A correct solution of this problem is actually quite tricky and
involved. I shall try to commit the change to ADOL-C svn soon. In the
meantime please don't enable FE_DIVBYZERO. Inf and NaN are correct
answers according to IEEE standard arithmetic.

Kshitij Kulshreshtha

Institut für Mathematik,
Universität Paderborn,
Warburger Straße 100,
33098 Paderborn.

Büro: A3.235

Arnikaweg 62
33100 Paderborn.

More information about the ADOL-C mailing list