Bug 88657 - entered fractions misinterpreted; format '# ??/???' is not retained after saving.
Summary: entered fractions misinterpreted; format '# ??/???' is not retained after sav...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Laurent Balland
URL:
Whiteboard: target:5.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-21 09:53 UTC by Thomas Käfer
Modified: 2016-10-25 19:03 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample file (15.00 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-01-22 00:41 UTC, m_a_riosv
Details
File with fraction formatting differences (55.22 KB, application/ods)
2016-03-06 00:12 UTC, bradley.wilkinson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Käfer 2015-01-21 09:53:45 UTC
entering the fraction
73/200 (which is 0.365) by entering
"0 73/200" displays 3/8 afterwards, which is 0.375

Is this some kind of rounding problem? can this be turned off?
Or is this a bug in the code that "automatically reduces" fractions?
https://help.libreoffice.org/Calc/Entering_Fractions


I'm Running Linux Mint 17.1 with LibreOffice:
Version: 4.2.7.2
Build ID: 420m0(Build:2)
Comment 1 raal 2015-01-21 12:36:20 UTC
Hello,
use your own format # ??/???

See the last paragraph in the help.

When I use  format of cell # ??/???, calc display 73/200 and value is 0,365
I'm closing this as notabug, set to unconfirmed again if you still observe the bug.
Comment 2 GerardF 2015-01-21 15:33:47 UTC
Reopen because 3 or more digits (???) for divisor is not retained after saving.

Cell formatted # ??/??? as suggested. Works untill spreadsheet is closed.
Closed and reopened: cells show default # ??/?? format.
Comment 3 raal 2015-01-21 19:32:42 UTC
I can confirm with Version: 4.5.0.0.alpha0+
Build ID: 88562ee6e352b5446bb55e906e8f1c2f34035a49
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2015-01-16_23:58:11
Comment 4 m_a_riosv 2015-01-22 00:41:46 UTC
Created attachment 112629 [details]
Sample file

Attached file open for me with three places for divisor, several versions.
Last Win7x64
Version: 4.5.0.0.alpha0+
Build ID: b3b4bbaf6cbd2226b659fea7d6ae473ccf84e9dd
TinderBox: Win-x86@39, Branch:master, Time: 2015-01-12_06:13:44
Comment 5 raal 2015-01-22 08:54:27 UTC
(In reply to m.a.riosv from comment #4)
> Created attachment 112629 [details]
> Sample file
> 
> Attached file open for me with three places for divisor, several versions.
> Last Win7x64
> Version: 4.5.0.0.alpha0+
> Build ID: b3b4bbaf6cbd2226b659fea7d6ae473ccf84e9dd
> TinderBox: Win-x86@39, Branch:master, Time: 2015-01-12_06:13:44

# ???/??? works
# ??/???  doesn't work

Could you test?
Comment 6 m_a_riosv 2015-01-22 21:07:03 UTC
Yes as you comment.

I don't know maybe is mandatory both sides having the same lenght.
Comment 7 Horst 2015-10-17 19:56:01 UTC
See also question here
https://ask.libreoffice.org/en/question/59529/inserting-fractions-in-the-calc-cell/?answer=59616#post-id-59616

Tested # ??/??? in LO 5.0.2.2 which is still not saved in .ODS.
Comment 8 bradley.wilkinson 2016-03-06 00:12:38 UTC
Created attachment 123328 [details]
File with fraction formatting differences

Cells D32 to D42 contain the formatting I have questions about
Comment 9 Laurent Balland 2016-05-03 21:23:37 UTC
When exporting, same value (nPrecision) is stored for both nNumeratorDigits and nDenominatorDigits. See call with WriteFractionElement_Impl
http://opengrok.libreoffice.org/xref/core/xmloff/source/style/xmlnumfe.cxx#1467
  WriteFractionElement_Impl( nInteger, bThousand, nPrecision, nPrecision, nDenominator );

http://opengrok.libreoffice.org/xref/core/xmloff/source/style/xmlnumfe.cxx#WriteFractionElement_Impl
  void SvXMLNumFmtExport::WriteFractionElement_Impl(
                      sal_Int32 nInteger, bool bGrouping,
                      sal_Int32 nNumeratorDigits, sal_Int32 nDenominatorDigits, sal_Int32 nDenominator )
Comment 10 Commit Notification 2016-05-09 14:09:54 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=8f8fa5674d3853ed8ca6762b512e6b63c53f1039

tdf#88657 calculate denominator length

It will be available in 5.2.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 11 Commit Notification 2016-05-18 20:46:29 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

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

add test for tdf#88657

It will be available in 5.2.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.