Post Reply 
Digit Grouping, HP Prime G2
09-05-2019, 08:02 PM
Post: #1
Digit Grouping, HP Prime G2
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


Attached File(s) Thumbnail(s)
   

http://www.dg8fbv.de
41CX, Card R., Barcode R., X-Function, X-Memory, Advntg-Modul,
HP41 Printer, 82200A Touchpad, 48GX black LCD, 50g, Prime G2
Find all posts by this user
Quote this message in a reply
09-05-2019, 09:49 PM (This post was last modified: 09-05-2019 09:58 PM by StephenG1CMZ.)
Post: #2
RE: Digit Grouping, HP Prime G2
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-12...ght=Pragma
It is intended to allow programs to be written using different separators than in your home settings, with the correct parameters.

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
09-05-2019, 09:57 PM
Post: #3
RE: Digit Grouping, HP Prime G2
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
Find all posts by this user
Quote this message in a reply
09-05-2019, 11:03 PM
Post: #4
RE: Digit Grouping, HP Prime G2
(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-12...ght=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!

http://www.dg8fbv.de
41CX, Card R., Barcode R., X-Function, X-Memory, Advntg-Modul,
HP41 Printer, 82200A Touchpad, 48GX black LCD, 50g, Prime G2
Find all posts by this user
Quote this message in a reply
09-05-2019, 11:06 PM
Post: #5
RE: Digit Grouping, HP Prime G2
(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.

http://www.dg8fbv.de
41CX, Card R., Barcode R., X-Function, X-Memory, Advntg-Modul,
HP41 Printer, 82200A Touchpad, 48GX black LCD, 50g, Prime G2
Find all posts by this user
Quote this message in a reply
09-05-2019, 11:13 PM
Post: #6
RE: Digit Grouping, HP Prime G2
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).

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
09-05-2019, 11:27 PM
Post: #7
RE: Digit Grouping, HP Prime G2
@StephenG1CMZ, @Han

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

Thank you!

http://www.dg8fbv.de
41CX, Card R., Barcode R., X-Function, X-Memory, Advntg-Modul,
HP41 Printer, 82200A Touchpad, 48GX black LCD, 50g, Prime G2
Find all posts by this user
Quote this message in a reply
09-06-2019, 05:33 AM
Post: #8
RE: Digit Grouping, HP Prime G2
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

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
09-06-2019, 10:42 AM
Post: #9
RE: Digit Grouping, HP Prime G2
(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........

http://www.dg8fbv.de
41CX, Card R., Barcode R., X-Function, X-Memory, Advntg-Modul,
HP41 Printer, 82200A Touchpad, 48GX black LCD, 50g, Prime G2
Find all posts by this user
Quote this message in a reply
09-09-2019, 04:38 AM
Post: #10
RE: Digit Grouping, HP Prime G2
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.

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
09-09-2019, 03:47 PM
Post: #11
RE: Digit Grouping, HP Prime G2
(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.....

http://www.dg8fbv.de
41CX, Card R., Barcode R., X-Function, X-Memory, Advntg-Modul,
HP41 Printer, 82200A Touchpad, 48GX black LCD, 50g, Prime G2
Find all posts by this user
Quote this message in a reply
09-10-2019, 04:48 AM
Post: #12
RE: Digit Grouping, HP Prime G2
(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?

Sorry for my english
Find all posts by this user
Quote this message in a reply
09-10-2019, 04:56 AM
Post: #13
RE: Digit Grouping, HP Prime G2
(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
Find all posts by this user
Quote this message in a reply
09-13-2019, 04:49 PM
Post: #14
RE: Digit Grouping, HP Prime G2
(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! ;-)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)