HP Forums

Full Version: point, comma, semicolon confusion
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
While testing out the code kindly provided by another user, I stumbled onto the following confusion:

1. The code as provided ran just fine on the emulator on my desktop PC
2. The same code would not run on my laptop, nor my HP Prime device

After some investigation I learned the following:
1. I had to replace all delimiter comma's in the code for semicolons
2. I had to replace one decimal point for a decimal comma

Now, where does all this come from?
1. Changing the language setting in the emulator or the device does not make a difference
2. While entering parameters to the standard function NORMALD_CDF(), pressing the comma key actually gives me a semicolon (The Help function tells me to use comma's (?))
3. Calculating decimal numbers is giving me comma's on the screen.

Now, this last one could be tracked back to one of the personal settings: Number Format

For Program Code all this confusion can be quite a bother and actually provides a barrier in sharing and reusing programs.
- So, is this in fact a bug?
- Shouldn't the programming environment be robust wrt personal number format settings?
- And where or when did the delimiter comma change into a semicolon?

Let me add my data:
- Software version: 2.1.14433 (2020 01 21)
- Hardware version: D
- CAS version: 1.5.0
- Serial number: skip
- OS: V2.060.650
For that reason we have #pragma, which allows programs to be passed between different calculators with custom configurations.
In the program press Menu/Insert #pragm
Thank you for that tip.

I actually went back to the emulator on my desptop PC (where the code runs) and changed its Number Format to a decimal comma.
From that point the program did not run anymore.
So the Number Format definitely seems the cuplrit here.

Following your suggestion I edited the program, inserting the #pragma
Code:
#pragma mode( separator(,;;) Integer(h32) )

The syntax error remains, pointing at the first separator comma.
Should I have changed something in the #pragma command?
HA!
Inserting the #pragma is also dependant upon the current Number Format setting of the device!

So,
1. FIRST reset the Number Format to standard decimal point 123,456.789
2. THEN insert the #pragma

The #pragma now becomes:
Code:
#pragma mode ( separator(.,;) integer (h32) )

And now it works.
Thanks
Hello,

Yep, you got it...

Although it is nice to be able to use one native "separator", it, unfortunately, only works well when you only talk to your own group :-(

Prime does have a number format to make it easier to do simple math in your idiom...

However, when programming it becomes much more complicated as, traditionally, characters such as ',' or ';' already have well defined use... causing conflicts...

Some efforts have been made to allow coma folks (I am one of the BTW) to program in coma mode, BUT they are limitations

Similarly in the CAS, which is in fact a scripting language, does not support coma mode at all...

The #pragma directive was created to allow program to be made compatible...

Cyrille
(03-03-2020 07:55 AM)cyrille de brébisson Wrote: [ -> ]Some efforts have been made to allow coma folks (I am one of the BTW) to program in coma mode, BUT they are limitations

Similarly in the CAS, which is in fact a scripting language, does not support coma mode at all...

Err... "Coma" means the same as in French. I think you mean "comma" (virgule) ? Big Grin
Hello,

Coma (english) = virgule (french)...

When I created the current Prime "Digit grouping" display system, I discovered how messed up the situation was word wide..

'.' vs ',' is just the tip of the iceberg...
Some countries group by 3 digits, some by 4, some by 3, then groups of 2, some have a separator on the top (switzerland), some use different notations depending on the context (financial, non financial)...

Some expect to enter the data in the same format as they see it, some expect to enter the data in a way, but see it in another....

All in all, a programmer's nightmare!

Cyrille
(03-04-2020 07:52 AM)cyrille de brébisson Wrote: [ -> ]Coma (english) = virgule (french)...

Nope.

Coma (English) = coma (français)

Comma (English) = virgule (français) Smile
This folks is a best case scenario...

A Frenchman that speaks English arguing with an Englishman that speak French, debating a French / English translation.

Lets get some seats and watch... Wink
… with the added value that both coma mode and comma mode are relevant, unrelated, topics for the Prime Smile
(03-04-2020 03:26 PM)rprosperi Wrote: [ -> ]This folks is a best case scenario...

A Frenchman that speaks English arguing with an Englishman that speak French, debating a French / English translation.

Lets get some seats and watch... Wink

I'll bring the popcorn (or is that le pop corn?) Big Grin
Hello,

>A Frenchman that speaks English arguing with an Englishman that speak French, debating a French / English translation.

Actually, the problem here is not about "speaking" French or English, but writing them :-) which is, unfortunately not my strongest suit...
Thanks for pointing it out...

>I'll bring the popcorn (or is that le pop corn?)
Sure, as long as it's sugary... French pop corn is not salted (well, you now do find salted pop corn but this is a relatively recent import)...

Cyrille
(03-05-2020 12:35 AM)cdmackay Wrote: [ -> ]… with the added value that both coma mode and comma mode are relevant, unrelated, topics for the Prime Smile

I think one of my students was in coma mode just today in class. Big Grin
(03-05-2020 07:15 AM)cyrille de brébisson Wrote: [ -> ]Hello,

X

>I'll bring the popcorn (or is that le pop corn?)
Sure, as long as it's sugary... French pop corn is not salted (well, you now do find salted pop corn but this is a relatively recent import)...

Cyrille

Past times that I visited France they offered me no sweet popcorns, but fresh croissants ?

Before MetaKernel I never thought of France & Math at the same time. Now I envy French because of Prime, Parisse, et Popcorn because they all are sweet!
(03-05-2020 11:02 PM)CyberAngel Wrote: [ -> ]Before MetaKernel I never thought of France & Math at the same time. Now I envy French because of Prime, Parisse, et Popcorn because they all are sweet!

Yum! MetaKernels of pop corn!
(03-05-2020 11:02 PM)CyberAngel Wrote: [ -> ]Before MetaKernel I never thought of France & Math at the same time. Now I envy French because of Prime, Parisse, et Popcorn because they all are sweet!

(Pssst... you forgot Cyrille, even if it doesn't begin with P...)
(03-06-2020 02:17 AM)rprosperi Wrote: [ -> ]
(03-05-2020 11:02 PM)CyberAngel Wrote: [ -> ]Before MetaKernel I never thought of France & Math at the same time. Now I envy French because of Prime, Parisse, et Popcorn because they all are sweet!

(Pssst... you forgot Cyrille, even if it doesn't begin with P...)

Brébisson, Bernard, Bastille, Bernadotte, barbe à queue
Brigitte Bardot !!!
(03-06-2020 05:53 PM)CyberAngel Wrote: [ -> ]
(03-06-2020 02:17 AM)rprosperi Wrote: [ -> ](Pssst... you forgot Cyrille, even if it doesn't begin with P...)

Brébisson, Bernard, Bastille, Bernadotte, barbe à queue

Touché Smile
Reference URL's