We have moved to a new Sailfish OS Forum. Please start new discussions there.

# Bug: Can't divide by previous result in calculator

Tracked by Jolla

In the native calc-application, I can't divide number with previous result. For example 5×3 and then 25/<previous result> results in 15/0 when it should result in 25/15. In other words, we have "25" as the numerator, so tapping the previous result should put it below the line, but actually it replaces "25".

edit retag close delete

This is still not working in 1.0.5.16. All other operand are working properly though. It looks like because division is treated as a block by itself., whereas other operations generate new blocks.

( 2014-04-16 10:50:32 +0300 )edit

Yes, can confirm it on Tahkalampi 1.0.8.21

( 2014-12-09 11:53:04 +0300 )edit

Yes, can confirm it also on 1.1.1.27 :)

( 2015-02-03 18:38:07 +0300 )edit
1

When I just tried it this happened:

100 / 5 = 20 1 / [press on result] [denominator shifts to numerator position] 20 / 0 = infinity

So, when I enter 1 / the previous result, the previous result is actually shifted from the place of the denominator to the place of the numerator. The previous numerator disappears altogether and the new denominator is zero.

( 2015-05-24 11:44:11 +0300 )edit
1

Still exists on 1.1.6.27

( 2015-06-24 20:25:37 +0300 )edit

Sort by » oldest newest most voted

Bump. This long known bug makes me sad, and it is still not fixed.

more

A mediocre workaround for now: first divide by 1, then divide again by the number you actually want.

You can now edit both dividend (12, A) and divisor (3, B)

To do "divide 1 by a previous result", enter 1 ÷ 1 ÷ [tap previous result]:

more

Another bump on this one. Still exists in Sailfish X 3.0.0.8, after nearly five years!

more

Not really a proper fix, but anyway, it allows to do calculations without copying result by hand. Here is a patch that circumvents the bug in DeclarativeField::link() proprietary function. When a fraction is used, the denominator is copied instead of being linked.

--- CalculationsListView.qml    2015-09-05 00:28:38.000000000 +0200
+++ CalculationsListView.qml.new    2016-02-12 10:33:55.367393552 +0100
@@ -110,7 +110,7 @@
coverMode: calculationsListView.coverMode

+                    onClicked: activeCalculation.focusField.fraction ? activeCalculation.insert(calculation.result.valueText) : activeCalculation.focusField.link(calculation.result)
}
}
}


The proper fix would be to change the proprietary function to asign the DeclarativeResult to the denominator when DeclarativeField::fraction is true.

more

It will be nice if this is discussed with Jolla on dev IRC :)

( 2016-02-12 14:01:05 +0300 )edit

Yes, but I'm afraid that sailors are too busy with more important stuff like telephony and so on to take time for this small bug. Besides the patch is just a workaround and not a fix since IMHO the bug is in the C++ proprietary side. So this patch won't really help them. It's more of a push from me to go in the open source direction for the calculator : community can help !

( 2016-02-13 00:02:32 +0300 )edit
1

To me this seems like a bug which could be fixed in 15 minutes. Yeah there are more important things, yadayada, but I find these kind of bugs, trivial to reproduce and probably trivial to fix, perfect in-between fillers, e.g. at the end of the day, or between two larger tasks, or just because the damn ticket is too simple to leave it on the board for so long.

I really like the calc app. Delightfully simple and powerful. But this bug... come on. Just ditch the special divider notation, and make it like the other operators, i.e. 15 ÷ 3 = 5

( 2016-02-13 00:28:24 +0300 )edit

https://together.jolla.com/question/57069/calculator-source-code/ Am sure you must have voted here - Ideal candidate, don't believe anything is proprietary in this simple app! ;)

( 2016-02-18 12:24:05 +0300 )edit

Yes voted already. The pseudo-patch above was more an attempt to show what open source can do than a real patch for this issue.

( 2016-02-18 19:38:11 +0300 )edit