Bug 104268

Summary: Solver: Current Solution is always displayed with 2 decimals
Product: LibreOffice Reporter: Laurent Balland <jumbo4444>
Component: CalcAssignee: Laurent Balland <jumbo4444>
Status: VERIFIED FIXED    
Severity: normal CC: miguelangelrv
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard: target:5.3.0.1
Crash report or crash signature: Regression By:
Attachments: Screenshot with solver box and result
Screenshot of solver with "Current Solution" at 0.00

Description Laurent Balland 2016-11-29 21:10:19 UTC
Description: When NLPSolver is searching solution, Current Solution is displayed with format "%.2f" which is not optimal for all cases. If solution is less than 0.01, then no evolution is displayed.

Steps to reproduce:
1. In A2 enter formula "=SIN(A1)*COS(A1)/1000"
2. Tools > Solver, Target cell "$A$2", "Maximum", By changing cells "$A$1"
3. Solve

Actual behavior:
Current Solution displays "0.00"

Expected behavior:
Value of solution should be displayed with more decimals or with scientific format

Entry point:
http://opengrok.libreoffice.org/xref/core/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java#180
Comment 1 m_a_riosv 2016-11-29 22:54:44 UTC
Created attachment 129144 [details]
Screenshot with solver box and result

Hi Lauren,

I can't reproduce with:
Version: 5.2.3.3 (x64)
Build ID: d54a8868f08a7b39642414cf2c8ef2f228f780cf
CPU Threads: 4; OS Version: Windows 6.19; UI Render: GL; 
Locale: es-ES (es_ES); Calc: groupeproduce with 

result on A2: 0,0005

Default style has 'Standar' for numbers on my instalation.
Comment 2 Laurent Balland 2016-11-30 12:21:45 UTC
Created attachment 129150 [details]
Screenshot of solver with "Current Solution" at 0.00

Sorry, I was not clear enough. I was speaking about value displayed in Solver UI. In your cell, you get of course the format you want.
Solver Status UI is displayed while solver is looking for solution. If it takes enough time (with more complex problem than the one described here), you can "Current Solution" value evolving, except if it is lower than 0.01.

There is a similar problem if solution reaches very high value, for instance with a goal function =SIN(A1)*COS(A1)*10^20 : value displays is 50000000000000010000.00 which is not very comfortable for user.
Comment 3 m_a_riosv 2016-11-30 14:37:32 UTC
Pls forgive my mistake.

Repro.
Version: 5.3.0.0.alpha0+ (x64)
Build ID: 170105956f843047d4c79657584f0c01aa7814c7
CPU Threads: 4; OS Version: Windows 6.19; UI Render: GL; 
TinderBox: Win-x86_64@62-TDF, Branch:MASTER, Time: 2016-08-19_17:41:46
Locale: es-ES (es_ES); Calc: group
Comment 4 Commit Notification 2016-12-12 12:27:34 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0412d863d144344b4c6c04b22209c0c57f1d6fb8

tdf#104268 NLPSolver: Improve display of solution

It will be available in 5.4.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2016-12-22 14:20:40 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d9ff86c9cf90925d0344b9572c651301847ca78c&h=libreoffice-5-3

tdf#104268 NLPSolver: Improve display of solution

It will be available in 5.3.0.1.

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

Affected users are encouraged to test the fix and report feedback.
Comment 6 m_a_riosv 2017-02-01 01:28:56 UTC
Tested
Versión: 5.3.1.0.0+
Id. de compilación: 096baf452992b91ce07a3ade9e7b3c0f4283df39
Subpr. de CPU: 4; Versión de SO: Windows 6.2; Repr. de IU: predet.; Motor de trazado: HarfBuzz; 
TinderBox: Win-x86@62-merge-TDF, Branch:libreoffice-5-3, Time: 2017-01-31_16:30:19
Configuración regional: es-ES (es_ES); Calc: CL