[ADOL-C] Bug in extreme cases of pow()
Samuel Leweke
s.leweke at fz-juelich.de
Thu Jul 31 04:43:54 EDT 2014
Hi,
I've noticed a bug in some special cases of the pow() function (see the
code attached).
The troubling statement is y = pow(x, e). The output for several values
of x and e (admittedly extreme cases) is given below:
x = 0, e = 0
y = 1
dy/dx = nan
dy/de = nan
======================
x = 1, e = 0
y = 1
dy/dx = 0
dy/de = 0
======================
x = 0, e = 1
y = 0
dy/dx = nan
dy/de = nan
======================
x = 1, e = 1
y = 1
dy/dx = 1
dy/de = 0
Let's check the values produced in each test.
Test 1: Since 0^0 = 1 and x^0 = 1 for all x != 0, dy / dx should be 0
here. The value of dy / de is correct because the derivative does not
exist (0^e is discontinuous at e = 0).
Test 2: This is correct.
Test 3: For fixed e, the function x^e is differentiable and its
derivative dy / dx is 1 for x = 0 and e = 1. For fixed x = 0, we have
0^e = 0 for all e > 0. Hence, we should get dy / de = 0 in this case.
Test 4: This is correct.
Am I doing something seriously wrong or is this really a bug? Is there a
work around for this bug to get the correct behavior?
Best regards,
Samuel Leweke
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: powBug.cpp
Type: application/octet-stream
Size: 1369 bytes
Desc: not available
URL: <http://list.coin-or.org/pipermail/adol-c/attachments/20140731/6f133868/attachment.obj>
More information about the ADOL-C
mailing list