point, comma, semicolon confusion - 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: point, comma, semicolon confusion (/thread-14582.html) |
point, comma, semicolon confusion - StephanP - 02-29-2020 09:25 AM 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 RE: point, comma, semicolon confusion - Carlos295pz - 02-29-2020 09:38 AM 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 RE: point, comma, semicolon confusion - StephanP - 02-29-2020 09:58 AM 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? RE: point, comma, semicolon confusion - StephanP - 02-29-2020 10:06 AM 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 RE: point, comma, semicolon confusion - cyrille de brébisson - 03-03-2020 07:55 AM 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 RE: point, comma, semicolon confusion - grsbanks - 03-03-2020 06:05 PM (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 Err... "Coma" means the same as in French. I think you mean "comma" (virgule) ? RE: point, comma, semicolon confusion - cyrille de brébisson - 03-04-2020 07:52 AM 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 RE: point, comma, semicolon confusion - grsbanks - 03-04-2020 08:07 AM (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) RE: point, comma, semicolon confusion - rprosperi - 03-04-2020 03:26 PM 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... RE: point, comma, semicolon confusion - cdmackay - 03-05-2020 12:35 AM … with the added value that both coma mode and comma mode are relevant, unrelated, topics for the Prime RE: point, comma, semicolon confusion - toml_12953 - 03-05-2020 02:05 AM (03-04-2020 03:26 PM)rprosperi Wrote: This folks is a best case scenario... I'll bring the popcorn (or is that le pop corn?) RE: point, comma, semicolon confusion - cyrille de brébisson - 03-05-2020 07:15 AM 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 RE: point, comma, semicolon confusion - Wes Loewer - 03-05-2020 11:38 AM (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 I think one of my students was in coma mode just today in class. RE: point, comma, semicolon confusion - CyberAngel - 03-05-2020 11:02 PM (03-05-2020 07:15 AM)cyrille de brébisson Wrote: Hello, 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! RE: point, comma, semicolon confusion - toml_12953 - 03-06-2020 12:59 AM (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! RE: point, comma, semicolon confusion - rprosperi - 03-06-2020 02:17 AM (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...) RE: point, comma, semicolon confusion - CyberAngel - 03-06-2020 05:53 PM (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! Brébisson, Bernard, Bastille, Bernadotte, barbe à queue RE: point, comma, semicolon confusion - Dirk.nl - 03-06-2020 08:39 PM Brigitte Bardot !!! RE: point, comma, semicolon confusion - rprosperi - 03-06-2020 09:56 PM (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...) Touché |