HP Forums

Full Version: Digit Grouping, HP Prime G2
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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.
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
(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!
(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.
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).
@StephenG1CMZ, @Han

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

Thank you!
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
(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........
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.
(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.....
(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?
(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
(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! ;-)
Reference URL's