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 610816 - Programming mode: Show result in base 2, 8, 10, 16
Programming mode: Show result in base 2, 8, 10, 16
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
unspecified
Other Linux
: Low enhancement
: ---
Assigned To: gcalctool maintainers
gcalctool maintainers
Depends on:
Blocks:
 
 
Reported: 2010-02-23 14:36 UTC by Emmanuel Pacaud
Modified: 2010-04-23 00:13 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Emmanuel Pacaud 2010-02-23 14:36:30 UTC
Using the programming mode of gcalctool, it could be expected to be able to work with different bases easily.

What could help would be:

- to always display the result in the main used bases: binary, hexadecimal, decimal.

- to allow the use of prefix for numbers, which would help to do mathematics with number in different bases. For example: 10 + 0x3a + 0b00001001
Comment 1 Robert Ancell 2010-02-23 22:05:38 UTC
Hi Emmanuel,

What version of gcalctool are you using?  In 5.29.x you can mix bases, except you use the mathematical suffix, e.g.

10 + 3₁₆ + 00001001₂

(Currently it is a bit tedious to write the suffix each time, see bug #610759)

I'm not sure what you mean by your first question "to always display the result in the main used bases: binary, hexadecimal, decimal."
Comment 2 Emmanuel Pacaud 2010-02-24 09:58:06 UTC
Hi,

I'm using gcalctool 5.29.91.

I didn't find the mixed bases feature for two reasons:

First, I think it's a bit weird to use this suffix notation in a "programming" mode, which is obviously intended to programmers. Programmers are probably more used to prefixes, like the 0x one. And prefix are easy to enter using the keyboard.

Neverthless, I did try the suffix buttons, but encountered a bug which made me think they was for another purpose.

If I try to enter f0₁₆, I get:

Function 'f' is not defined

Back to my first suggestion: "always display the result in the main used bases" is a proposal for an extension of the binary widget (the one just under the entry widget), wich would also display the value in hexadecimal.

Thanks,

    Emmanuel.
Comment 3 Robert Ancell 2010-02-24 22:38:31 UTC
Oh, I see, add a new widget beside the binary editor (or similar location) that shows the result in all common bases simultaneously.  Yes, I have been thinking of something similar.  Updated bug title.

I've fixed the bug you found - it was not working with lower case hexadecimal numbers.

If you hadn't hit that problem would the suffixes have been discoverable? (Also note you can use Ctrl+B, Ctrl+O Ctrl+H as a shortcut for these or alt+n for lowecase numbers).
Comment 4 Emmanuel Pacaud 2010-02-26 09:09:19 UTC
> If you hadn't hit that problem would the suffixes have been discoverable?

Hard to say. I guess so.

> (Also note you can use Ctrl+B, Ctrl+O Ctrl+H as a shortcut for these or
> alt+n for lowecase numbers).

Having the shortcuts in the tooltips would be nice.

I've found another minor annoyance. If you begin to enter a decimal number, the binary widget is updated automatically. But it doesn't work with hexadecimal numbers, even after the suffix is entered.
Comment 5 Robert Ancell 2010-03-01 01:10:52 UTC
binary editor now works for different bases
Comment 6 Tim-Philipp Müller 2010-04-06 18:44:33 UTC
> > (Also note you can use Ctrl+B, Ctrl+O Ctrl+H as a shortcut for these or
> > alt+n for lowecase numbers).

It's nice to know this functionality still exists. I was a bit shocked at first when I started the new gcalctool and saw/thought it didn't have a way any more to switch results between different bases on the fly in programming mode.

This is not very discoverable at all though, I think there should be either buttons or menu entries for this (to change the base the results are displayed in) in programming mode, since it really is rather essential functionality IMHO.

As it turns out the keyboard shortcuts are even documented in the documentation, but I didn't find them there at first, since I opened the Contents and then went to Conversions -> Number Bases, where it only talks about the preferences dialog, and doesn't link to Numbers -> Number Bases.
Comment 7 Mike Auty 2010-04-16 16:35:10 UTC
Sorry to chime in here, but I wanted to stress that this might be more than just a "low enhancement" since, as someone who only used gcalc primarily for converting between hex and decimal values, this seems like a regression (let alone whether it's low or not).

First off, I don't think the shortcut keys will help change the result display base, since if you paste a decimal into gcalc set to display in decimal, and then do Ctrl+H, it'll simply assume the input was hex and display an even larger decimal number.  As far as I'm aware you currently *have* to go through the dialog box to change the display base?

This problem would be solved by showing all output formats at once, however, this would still be unintuitive.  For example, if you wanted to do addition on two hexadecimal values and see the result in hexadecimal, even if you remember to specify the output as hex via the dialog, you've still got to specify the bases on both numbers, otherwise it will give you the "not a function" error if your hex happens to contain letters, or worse, it'll process it as if it were in decimal and give you no error, so you may not even notice your calculations are incorrect!

Having the A-F keys (especially now enabled all the time) in programming mode is just as misleading, since on their own, no matter the display base, they will give unexpected results (from an error message through to calling random functions unexpectedly).

I can understand that for scientific/financial/engineering purposes the new features/engine may be very useful, but for programming, the separation between input base and display base makes it very difficult to work with multiple bases.  Being able to add suffixes to variables is fine (even though, as mentioned, programmers are already used to working with prefixes, so again you're making them change their mental model to fit the program), but it would be much easier if all input was assumed to be in the display base, and then the user can add suffixes only if it's not in the base they're looking at.

So to sum up: please restore the ability to move quickly between display bases, and also default to the display base when numbers are input. If you'd like me to file these as separate bugs, let me know, I'll be happy to do so...
Comment 8 Robert Ancell 2010-04-23 00:13:49 UTC
Hi Mike, I think these issues are all resolved on the master branch.  Thanks for the feedback.