lcd weather station display issue for temperatures over 99F

Bug #396278 reported by Andy St.Martin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kdeplasma-addons (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: plasma-widgets-addons

The LCD Weather Station plasma widget does not correctly display temperatures over 99.9 F. This occurs when in the "small" format in the "panel". Only 3 digits are displayed. Instead of displaying "105.0"; "05.0" is displayed.

It would be fine if the tenths of degrees were dropped and "105" was displayed. (After 101F, tenths of degrees are not significant :-) )

This was found in the KDE 4.3 RC1 backport to Jaunty: 4:4.2.95-0ubuntu1~jaunty1~ppa1

Revision history for this message
Andy St.Martin (andystmartin) wrote :

There is an operator precedence snafu in WeatherStation::fitValue in weatherstation.cpp.

The line checking that the number of digits of the temperature is less than the total digits allowed looks like this:
    if (mainDigits < 3 && mainDigits + (v < 0)?1:0 + 1 < digits) {

The "?:" is supposed to add 1 ito the mainDigits if the temp is less than 0. However, '+" and '<' have higher precedence than "?:". This yields an expected value. When parentheses are properly inserted, the correct value is evaluated. Such as:
    if (mainDigits < 3 && (mainDigits + ((v < 0)?1:0) + 1) < digits) {

Finally, the last "<" should probably be a "<=". If 3 digits are allowed and allowing for a tenth of a degree is 3 or less, then display the tenth. I think the final, correct expression should look something like this:
    if (mainDigits < 3 && (mainDigits + ((v < 0)?1:0) + 1) <= digits) {

Revision history for this message
Alessandro Ghersi (alessandro-ghersi) wrote :

Is still an issue with Karmic or Lucid?
Thanks

Changed in kdeplasma-addons (Ubuntu):
status: New → Incomplete
Revision history for this message
Alessandro Ghersi (alessandro-ghersi) wrote :

Looks like is fixed.

Changed in kdeplasma-addons (Ubuntu):
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.