Bug 129098 - Two parameters incorrectly labelled on Calc Function Wizard for OPT_PROB_INMONEY function
Summary: Two parameters incorrectly labelled on Calc Function Wizard for OPT_PROB_INMO...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.2.7.1 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:6.5.0 target:6.3.5 target:6.4.0.1
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-29 11:10 UTC by Steve Fanning
Modified: 2019-12-04 22:23 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
patch (965 bytes, patch)
2019-11-29 15:12 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Fanning 2019-11-29 11:10:19 UTC
Description:
For the OPT_PROB_INMONEY function when selected in the Function Wizard, the "put/call" and "strike" arguments have the wrong labels (they should be swapped). At the moment you can enter a "p" or "c" in the strike argument and a numeric value in the "put/call" field.

Steps to Reproduce:
1.Open Function Wizard
2.Select Financial from the Category menu
3.Select OPT_PROB_INMONEY from Function menu
4.Enter "p" or "c" in put/call argument box. Note how Err502 reported in Result field of Function Wizard.
5.Repeat above but entering 80 in strike argument box

Actual Results:
Entering "p" or "c" in strike field is allowed. Entering 80 in "put/call" field is allowed.

Expected Results:
Entering "p" or "c" in strike field should not be allowed. Entering 80 in "put/call" field should not be allowed.


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 Julien Nabet 2019-11-29 14:51:07 UTC
On Win10 with master sources updated today, I could reproduce this.

Taking a look at:
66         /// OPT_PROB_INMONEY(), probability of ending up in-the-money.
67         double getOptProbInMoney( [in] double spot, [in] double vol,
68             [in] double mu, [in] double maturity,
69             [in] double barrierLow, [in] double barrierUp,
70             [in] any strike, [in] any putCall )
71             raises( com::sun::star::lang::IllegalArgumentException );
https://opengrok.libreoffice.org/xref/core/scaddins/idl/com/sun/star/sheet/addin/XPricingFunctions.idl?r=8d0dbbda#66

200     virtual double SAL_CALL getOptProbInMoney( double spot, double vol,
201              double mu, double T,
202              double barrier_low, double barrier_up,
203              const css::uno::Any& strikeval, const css::uno::Any& put_call ) override;
https://opengrok.libreoffice.org/xref/core/scaddins/source/pricing/pricing.hxx?r=c4ab5781#200

There's indeed a mix between the 2 last args in the UI.
Comment 2 Julien Nabet 2019-11-29 15:12:53 UTC
Created attachment 156184 [details]
patch

I'll submit this patch when get back home.
If someone wants to submit it on gerrit before, don't hesitate!
Comment 3 Julien Nabet 2019-11-29 15:42:36 UTC
Taking a look at https://cgit.freedesktop.org/libreoffice/core/commit/?id=e9f31eaa49f9494113e72deaf0fe079701844ea4, it's been the case at the beginning  when the function has been implemented, if I interpret well the commit.
Comment 4 Julien Nabet 2019-11-29 16:50:05 UTC
https://gerrit.libreoffice.org/#/c/84078
Comment 5 Commit Notification 2019-11-29 19:20:57 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b1832658951d9f03c871b665b270a73deacf884f

tdf#129098: parameters mixed in OPT_PROB_INMONEY (scaddins)

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Julien Nabet 2019-11-29 19:22:00 UTC
Cherry-picks waiting for review:
- 6.4: https://gerrit.libreoffice.org/#/c/84088/
- 6.3: https://gerrit.libreoffice.org/#/c/84089/
Comment 7 Commit Notification 2019-12-04 22:23:26 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/commit/b414e1b9fc428279bfd4258537f0a1d2de2a343b

tdf#129098: parameters mixed in OPT_PROB_INMONEY (scaddins)

It will be available in 6.3.5.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2019-12-04 22:23:36 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/9fb18eb82c24a3dd66e12aef1082422b7c924034

tdf#129098: parameters mixed in OPT_PROB_INMONEY (scaddins)

It will be available in 6.4.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.