inserting fractions in the calc cell

in the calc cells if I enter 9/100 it shows 8/89. Any one please tell how to fix this problem.

Thanks a lot for your help.

What is your locale, what your UI language, what your OS, what you OS language/locale, what your LibO version? Even knowing all that I might not have help for you. Without this information it’s hopless. My LibO doesn’t behave that way. Down with silly "recognition!

Go to the “Format Cells” as shown by Alex Kemp. Then select Fractions on left side. You will see in the middle column 2 predefined formats: # ?/? and # ??/??. select the second one ( where it says now General you will see it) and modify it to # ??/???.

Then you get your right display.

ADDON: My solution is only good for the actual session. LO does not save the fraction anywhere, so it gets lost after saving and reopening. Although it saves other user-defined formats (had some phone number saved in the test file and there were still ok). I might have to write a bugreport.

2.ADDON: There is already a bug#88657 filed beginning of 2015. One workaround found and confirmed by me is to use

“# ???/???” as format. This works to and is saved.

Custom format codes not correctly saved / reloaded while first working as expected, are not restricted to ‘Fraction’ based formats.

If you decide to file a bug report: Would you mind to also post a link to it, here?

Hi GA316

The normal reason for wrong display of numbers containing a slash (’/’) as reported in ask.libo is that the default for Calc for the questioner is to format as a date. The reason in your case is a variant upon that, and for me has revealed a truly abominable piece of coding…

Try to Remember:

With Calc, each cell is rather like a human being:- there is the body & there are the clothes (display). Sometimes one matches the other, and sometimes not. Also, small boys have a habit of hiding things in their pockets (preciousss).

With the cursor within the cell containing ‘9/100’, try the following:

  1. (menu):FormatClear Direct Formatting (Ctrl+M)
    (from now on you will see the default format)
  1. (menu):FormatCells (Ctrl+1)
    (what is the value in Format code?)
    (mine was NumberGeneral, and the display showed for me as “9/100”)



    That previous result was because Calc silently inserted a hidden ’ (U+0027) APOSTROPHE within the cell before the 9/100; the APOSTROPHE could be seen in the input line of the Formula Bar only after changing the format to Fraction; it was always hidden within the cell, and otherwise hidden within the Formula Bar; I removed the APOSTROPHE and tried again (lo-5.0.0.5 Debian 6.0)



    (changing format to Fraction"# ??/??" then showed your result of 8/89 - hooray!)
    image description
  2. Modify Format code to "# ??/???"
    (display now returns to 9/100) (thanks horst)

    image description

If this helps then please tick the answer (:heavy_check_mark:)

…and/or show you like it with an uptick ()

@AlexKemp:
We talk about Numberformat-category: Fractions

(Edited)
You ( @GA316 ) had formatted the respective cell(s) using a format code like “# ?/??” or “# ?/#?” for fractions up to 2 digits for the denominator. 8/99 is the best approximation for 9/100 available if the denominator is limited to 2 digits.

Generally you shouldn’t expect reliable results displayed using ‘Fraction’ format. The arithmetic is always ‘Double’. Applying an algorithm of continued fractions afterwards is kind of a hoax. If you need exact fractional arithmetic you have to use mathematics software. (Maxima is free now.)

The fact that the number format ‘Fraction’ set for a cell also causes the “recognition” of “9/100” as not text can be seen as an inconsistency. This behaviour may get in conflict with a ‘date acceptance pattern’. Presently it will even override it. Did anyone at anytime specify the bahaviour of such toys?

(Editing again:)

@Horst may have a look into the attached example. I did, however, not yet demonstrate similar effects with non-fractional formats. (No examples stored formerly) ask59529FractionTests.ods

Additionally to answer by @horst:

You can also choose an Fractionsformatcode like # ??/100 to fix the denominator for some Reasons