After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 778311 - Temperature converter doesn't work with negative numbers
Temperature converter doesn't work with negative numbers
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
3.22.x
Other Linux
: Normal major
: ---
Assigned To: gcalctool maintainers
gcalctool maintainers
Depends on:
Blocks:
 
 
Reported: 2017-02-07 22:35 UTC by Nate Graham
Modified: 2017-02-13 20:30 UTC
See Also:
GNOME target: ---
GNOME version: 3.21/3.22


Attachments
gnome-calculator screenshot showing the problem (20.27 KB, image/png)
2017-02-07 22:35 UTC, Nate Graham
  Details
Fix unit conversion from negative constant numbers (6.25 KB, patch)
2017-02-13 18:44 UTC, PioneerAxon
committed Details | Review

Description Nate Graham 2017-02-07 22:35:55 UTC
Created attachment 345158 [details]
gnome-calculator screenshot showing the problem

Fedora 25 + GNOME 3.22.2
gnome-calculator-3.22.2-1.fc25

"20 degc in degf" works fine.
"0 degc in degf" works fine.
"−1 degc in degf" produces the following output: "unknown variable 'degc'"
Comment 1 Robert Roth 2017-02-08 17:30:29 UTC
This is a problem indeed. I have made an attempt to add the required parser changes (currently conversions only work for NUMBER UNIT IN UNIT token sequences), but it did not work. 
Adding PioneerAxon to CC, hoping he can give a hand here. If not, I will retry, I surely have missed something in my changes, maybe next time it will work out just fine.
Comment 2 PioneerAxon 2017-02-13 16:31:36 UTC
Robert, I think I have figured out a way to solve this.

I will first ensure that there are no regressions because of what I'm trying to do. Once I'm satisfied, I'll submit a patch.

It's been long since I wrote the initial parser in C, so my memory is a bit rusty in this area.
Comment 3 PioneerAxon 2017-02-13 18:44:34 UTC
Created attachment 345663 [details] [review]
Fix unit conversion from negative constant numbers