HP Forums
Digit Grouping, HP Prime G2 - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Digit Grouping, HP Prime G2 (/thread-13594.html)



Digit Grouping, HP Prime G2 - Thott - 09-05-2019 08:02 PM

Hello,

I found that many programs did not run, when I select for the decimal point a comma as it is usual here in EU.
When I change it back to "dot"......no problem at all.

E.g.: https://www.hpmuseum.org/forum/thread-9708.html

With a comma as decimal point the program did not run and shows a syntax error, when it is checked.
With a dot as decimal point it runs without problems.

It seems that the selection of the digit grouping must be in compliance with the programming.

HP Prime G2, newest firmware


RE: Digit Grouping, HP Prime G2 - StephenG1CMZ - 09-05-2019 09:49 PM

Are you aware of the pragma command?
If not, including a pragma as the first line of a program may help.
https://www.hpmuseum.org/forum/thread-12464.html?highlight=Pragma
It is intended to allow programs to be written using different separators than in your home settings, with the correct parameters.


RE: Digit Grouping, HP Prime G2 - Guido - 09-05-2019 09:57 PM

Hello Thott

(09-05-2019 08:02 PM)Thott Wrote:  I found that many programs did not run, when I select for the decimal point a comma as it is usual here in EU.

Switzerland is not a member of the EU but located in the center of Europe. We also use the dot as the deciamal point. Is a question of the country settings used in most operating systems. If this is not correct interpreted by the OS and the programs using this OS there is an error I think. But I don't know the Prime, so it's just a general position.

Regards,
Guido


RE: Digit Grouping, HP Prime G2 - Thott - 09-05-2019 11:03 PM

(09-05-2019 09:49 PM)StephenG1CMZ Wrote:  Are you aware of the pragma command?
If not, including a pragma as the first line of a program may help.
https://www.hpmuseum.org/forum/thread-12464.html?highlight=Pragma
It is intended to allow programs to be written using different separators than in your home settings, with the correct parameters.

Thank you for the fast reply!
I was not aware of the above mentioned.
I will try it......thanks again!


RE: Digit Grouping, HP Prime G2 - Thott - 09-05-2019 11:06 PM

(09-05-2019 09:57 PM)Guido Wrote:  Switzerland is not a member of the EU but located in the center of Europe. We also use the dot as the deciamal point. Is a question of the country settings used in most operating systems. If this is not correct interpreted by the OS and the programs using this OS there is an error I think. But I don't know the Prime, so it's just a general position.

Regards,
Guido

Thank you for the information.
I will try the pragma command as StephenG1CMZ mentioned it.


RE: Digit Grouping, HP Prime G2 - Han - 09-05-2019 11:13 PM

Normally, the author of the program should have included the #pragma statement so that users never have to worry about discrepancies between the author's settings when creating the program and the users' settings when they run the program.

That said, even the #pragma statement cannot help some very special edge cases that I personally ran into (e.g. using EXPR("input(...)") where the arguments of input() are separated by commas (or whatever the separation mark is).


RE: Digit Grouping, HP Prime G2 - Thott - 09-05-2019 11:27 PM

@StephenG1CMZ, @Han

It works. I put in the first line "#pragma mode( separator(.,;) integer(h32) )"

Thank you!


RE: Digit Grouping, HP Prime G2 - cyrille de brébisson - 09-06-2019 05:33 AM

Glad it worked!

All hail the mighty Prime development team who thought about everything :-)

joke aside, it helps that some of us are europe based...
Nevertheless although I prefer a coma as a separator, it is problematic as you quickly run out of punctuation when it comes to programming and this causes issues in cases such as local variable declarations where the system does not know how to differenciate between variable separator and end of instruction...
ie:
in . mode:
LOCAL A, B, C; clearly defines 3 vars,
but in , mode:
LOCAL A; B; C; // is very hard to interpret for the system

Cyrille


RE: Digit Grouping, HP Prime G2 - Thott - 09-06-2019 10:42 AM

(09-06-2019 05:33 AM)cyrille de brébisson Wrote:  Glad it worked!

[......]
[.....]

ie:
in . mode:
LOCAL A, B, C; clearly defines 3 vars,
but in , mode:
LOCAL A; B; C; // is very hard to interpret for the system

Cyrille

Thank you for the reply!
Is this not a point for the Prime firmware to interpret it in compliance with the digit grouping settings. I am not a specialist and don’t know if it is possible.

I think normal users, like me, are not aware of the #pragma statement.
Wondering why many available programs not running.....like me ?
And I believe most of the programmers do not add it to source code.

Thank you for your help to bring it to light........


RE: Digit Grouping, HP Prime G2 - cyrille de brébisson - 09-09-2019 04:38 AM

hello,

unfortunately, a lot of publicly posted programs do not have #pragma...

We discussed automatically adding pragma to any newly created program, but decided against it as it would be "strange" to beginners... and pause more problems that way...

Cyrille.


RE: Digit Grouping, HP Prime G2 - Thott - 09-09-2019 03:47 PM

(09-09-2019 04:38 AM)cyrille de brébisson Wrote:  hello,

unfortunately, a lot of publicly posted programs do not have #pragma...

We discussed automatically adding pragma to any newly created program, but decided against it as it would be "strange" to beginners... and pause more problems that way...

Cyrille.

Hello,

Yes indeed, automatically add some lines into source codes would be not the right way.
But I thought it could be handled in the Firmware to respect the current settings.

Let’s leave it at that. Every skilled programmer should know it and should add the respective lines.....


RE: Digit Grouping, HP Prime G2 - Tyann - 09-10-2019 04:48 AM

(09-09-2019 03:47 PM)Thott Wrote:  [quote='cyrille de brébisson' pid='120769' dateline='1568003927']
hello,

unfortunately, a lot of publicly posted programs do not have #pragma...

We discussed automatically adding pragma to any newly created program, but decided against it as it would be "strange" to beginners... and pause more problems that way...

Cyrille.

Bonjour
Pourquoi pas une option dans les paramètres d'accueil ?


Hello
Why not an option in the home settings?


RE: Digit Grouping, HP Prime G2 - CyberAngel - 09-10-2019 04:56 AM

(09-10-2019 04:48 AM)Tyann Wrote:  
(09-09-2019 03:47 PM)Thott Wrote:  [quote='cyrille de brébisson' pid='120769' dateline='1568003927']
hello,

unfortunately, a lot of publicly posted programs do not have #pragma...

We discussed automatically adding pragma to any newly created program, but decided against it as it would be "strange" to beginners... and pause more problems that way...

Cyrille.

Bonjour
Pourquoi pas une option dans les paramètres d'accueil ?


Hello
Why not an option in the home settings?

Yes, an "advanced option for any new program
AND
I don't think it's confusing with HELP assigned


RE: Digit Grouping, HP Prime G2 - Wes Loewer - 09-13-2019 04:49 PM

(09-06-2019 05:33 AM)cyrille de brébisson Wrote:  All hail the mighty Prime development team who thought about everything :-)

Indeed. I hope the guy that came up with the #pragma idea got a bonus! ;-)