Re: [QuantLib-svn] SF.net SVN: quantlib: [14167] trunk/QuantLib

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-svn] SF.net SVN: quantlib: [14167] trunk/QuantLib

Luigi Ballabio

On Wed, 2008-01-23 at 08:40 -0800, [hidden email] wrote:

> Revision: 14167
>           http://quantlib.svn.sourceforge.net/quantlib/?rev=14167&view=rev
> Author:   nando
> Date:     2008-01-23 08:40:46 -0800 (Wed, 23 Jan 2008)
>
> Log Message:
> -----------
> ... (warning: also moved displacement parameter in the same place as other functions)
>
> Modified: trunk/QuantLib/ql/pricingengines/blackformula.hpp
> ===================================================================
> --- trunk/QuantLib/ql/pricingengines/blackformula.hpp 2008-01-23 16:25:24 UTC (rev 14166)
> +++ trunk/QuantLib/ql/pricingengines/blackformula.hpp 2008-01-23 16:40:46 UTC (rev 14167)
> @@ -93,9 +93,10 @@
>                                     Real forward,
>                                     Real blackPrice,
>                                     Real discount = 1.0,
> +                                   Real displacement = 0.0,
>                                     Real guess = Null<Real>(),
>                                     Real accuracy = 1.0e-6,
> -                                   Real displacement = 0.0);
> +                                   Natural maxIterations = 100);
>  

Nando,
        consistency might be less important than usability in this case. Is the
displacement parameter more likely to be specified than the guess or the
accuracy? If not, it should stay where it was before. Also, it bothers
me that, if you move a default parameter like you did, old code will
keep compiling without as much as a warning but will behave
differently---the guess will be used as a displacement. It's gonna be a
hard one to debug for the poor users that don't read the SVN messages
(i.e., most of them...)

Luigi


--

Never mistake motion for action.
-- Ernest Hemingway



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-svn] SF.net SVN: quantlib: [14167] trunk/QuantLib

Ferdinando M. Ametrano-3
On Jan 23, 2008 6:05 PM, Luigi Ballabio <[hidden email]> wrote:

> > --- trunk/QuantLib/ql/pricingengines/blackformula.hpp 2008-01-23 16:25:24 UTC (rev 14166)
> > +++ trunk/QuantLib/ql/pricingengines/blackformula.hpp 2008-01-23 16:40:46 UTC (rev 14167)
> > @@ -93,9 +93,10 @@
> >                                     Real forward,
> >                                     Real blackPrice,
> >                                     Real discount = 1.0,
> > +                                   Real displacement = 0.0,
> >                                     Real guess = Null<Real>(),
> >                                     Real accuracy = 1.0e-6,
> > -                                   Real displacement = 0.0);
> > +                                   Natural maxIterations = 100);
>
>         consistency might be less important than usability in this case. Is the
> displacement parameter more likely to be specified than the guess or the
> accuracy? If not, it should stay where it was before. Also, it bothers
> me that, if you move a default parameter like you did, old code will
> keep compiling without as much as a warning but will behave
> differently---the guess will be used as a displacement. It's gonna be a
> hard one to debug for the poor users that don't read the SVN messages

I was aware of the issue, that's why I broke up my last commit in
multiple self-consistent chunks and added a warning in this one.
My personal opinion is that at least before 1.0 we should favor
consistency otherwise we'll never catch up on this side, and
documenting this change in next release might be enough.

What about considering alternatives? E.g. removing default parameters
from discount and displacement would partially force the user to look
at the function again...
Besides I can grant you that if you use the old guess as displacement
you might have no problem at compile time but you're gonna notice at
run time, so it would an evident change.

Anyway I'm willing to move back displacement between accuracy and
maxIterations... just confirm your preference and I'll do it

ciao -- Nando

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-svn] SF.net SVN: quantlib: [14167] trunk/QuantLib

Luigi Ballabio
On Wed, 2008-01-23 at 18:41 +0100, Ferdinando Ametrano wrote:
[ ... about default parameters in Black formulas ... ]
>
> What about considering alternatives? E.g. removing default parameters
> from discount and displacement would partially force the user to look
> at the function again...

Or possibly something like

blackFormulaImpliedStdDev(price, etc)
.withGuess(guess)
.withDisplacement(d);

What do you think?

> Besides I can grant you that if you use the old guess as displacement
> you might have no problem at compile time but you're gonna notice at
> run time, so it would an evident change.

I had no doubt about it :)  The problem is that unlike a compilation
error, just seeing wrong numbers come out makes more difficult to
pinpoint what changed and in what file.

Luigi


--

Zawinski's Law:
Every program attempts to expand until it can read mail. Those
programs which cannot so expand are replaced by ones which can.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev