QuantLib-Python works on alpha debian
Posted by Luigi Ballabio-4 on Jan 10, 2002; 2:54am
URL: http://quantlib.414.s1.nabble.com/interest-rate-models-and-next-release-tp9977p9979.html
>On Tue, Jan 08, 2002 at 04:36:28PM +0100, Ferdinando Ametrano wrote:
> > Another key issue would be to solve the problems we have on some
> platforms,
> > as Dirk pointed out. I know Luigi is working on that: Luigi please report
Ok, I just committed some changes which make QuantLib-Python compile and
pass all tests on alpha. I hope this will fix the problems on other
platforms as well.
Dirk: while a couple of bugs were ours only, one seems to be related with
some C or C++ library. If you have any idea of who's the maintainer of the
corresponding package, you might want to get in touch with him and report.
The bug can be reproduced on flatline.tdyc.com as follows:
ballabio@flatline:~$ python
Python 2.1.1+ (#1, Jan 9 2002, 03:47:01)
[GCC 2.95.4 (Debian prerelease)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import math
>>> math.exp(-700)
9.8596765437597708e-305
>>> math.exp(-750)
0.0
>>> math.exp(-720)
Floating point exception
ballabio@flatline:~$
i.e., there is a range of numbers around -720 which causes exp() to abort.
Also, the same was happening in a calculation inside libQuantLib, so that
the problem might be not in Python but rather in some math C or C++ library
which both QuantLib and Python link to.
I fixed the problem in our code by filtering the call to exp() and just
returning 0 if the exponent is below -700 or so, but it might be advisable
to report the thing if you have any idea who to report to.
Bye for now,
Luigi