Re: Comma Separated Values (8974 Views)
Posts: 53
Registered: ‎09-29-2012
Message 1 of 9 (9,189 Views)

# Comma Separated Values

[ Edited ]

I have been testing the new HP prime.  I performed the following multiplication: 12345 * 6789, the result was 83810205. Which is correct.

I did the same operation in a much cheaper calculator, BAII Plus-Pro. While entering the numbers it put a comma automatically, where needed... 12,345 * 6,789 = 83,810,205 ... Which is EXTREMELY more easy to read and less prompt to data entry errors.

HP 50G lacked that feature, which I never understood why. I'm surprised to see that HP prime seems to lack the same feature.

PLEASE, PLEASE... tell me the feature is hidden somewhere. Lacking this would be incomprehensible in a calculator this sophisticated. Where do I activate it???

PD: Yes, I know how to use engineering and scientific notation. That's not what I need.

Honored Contributor
Posts: 2,392
Registered: ‎02-09-2009
Message 2 of 9 (9,172 Views)

# Re: Comma Separated Values

[ Edited ]

Hi!, jc_cfa:

On the HP50G, you must configure, CALCULATOR MODE, to FIX xx (0 to 11).

On the HP PRIME GRAPHING CALCULATOR, it is not possible, at the moment, with the actual 5106 version, but you can ...

Posts: 53
Registered: ‎09-29-2012
Message 3 of 9 (9,163 Views)

# Re: Comma Separated Values

Hi, Miguel!

The trick works for the HP 50G, but only if I enter the number as a decimal (e.g., 1234. instead of 1234). However, in doing so I lose the advantage of working with exact integer calculations of large numbers.  In the HP prime it doesn't work at all.

Honored Contributor
Posts: 2,392
Registered: ‎02-09-2009
Message 4 of 9 (9,155 Views)

# Re: Comma Separated Values

Hi!, jc_cfa:

On the HP PRIME GRAPHING CALCULATOR, it is not possible, at the moment, with the actual 5106 version.

Trusted Contributor
Posts: 115
Registered: ‎09-25-2006
Message 5 of 9 (9,108 Views)

# Re: Comma Separated Values

[ Edited ]

jc_cfa wrote:

I have been testing the new HP prime.  I performed the following multiplication: 12345 * 6789, the result was 83810205. Which is correct.

I did the same operation in a much cheaper calculator, BAII Plus-Pro. While entering the numbers it put a comma automatically, where needed... 12,345 * 6,789 = 83,810,205 ... Which is EXTREMELY more easy to read and less prompt to data entry errors.

HP 50G lacked that feature, which I never understood why. I'm surprised to see that HP prime seems to lack the same feature.

Actually, there is a good reason that the Prime and the 50g (and all high-end HP calculators for many years) don't put commas in numbers as you type them in. It's because, unlike ordinary calculators which only deal with numbers, the Prime and 50g use a command line interface, which allows ANYTHING to be typed, including lists and arrays which use commas to separate elements.  Commas are used to parse what the user typed.  For example, suppose you want to enter the list of two numbers {123456,789}, but as you type it, the calculator adds commas. You'd end up with three numbers {123,456,789}. Not good.

Solutions have been suggested, tried, and found unworkable. In general, automatic commas during the INPUT of long numbers is simply impossible with a command line interface.

However, I agree with you that OUTPUT with commas is a necessary feature.  That's why I programmed a key on my 50g to display any exact integer (of any length) with commas inserted, correctly broken into multiple lines depending on current font size (normal or mini).  And if you press the same key with a "long float" number on the stack (floating point with settable number of decimal places), it displays all of its digits, correctly screen-wrapped by font size.  This is one of the benefits of HP programmable calculators; if you want a feature, you can easily add it.  It's annoying that you have to do this for features that really should already be there, but it's nice to know that you can add them yourself, and maybe even do it better than HP might have done it.

-Joe-

Disclaimer: I don't work for HP. I'm just another HP customer, like you.

-Joe-
Posts: 53
Registered: ‎09-29-2012
Message 6 of 9 (9,094 Views)

# Re: Comma Separated Values

Hi Joseph,

Thanks a lot for the explanation, very complete.  There must be a way to make it easier to input and read numbers, less prompt to errors. may be alternating colors or shades of gray. The programming approach is great.

My challenge is : if a feasible solution can be accomplished using the programmng language of the calculator, shouldn't it be included as a feature, or the code included as an example in the user's manual, for the benefit of those who are not good in computer programming.

Thanks

Posts: 53
Registered: ‎09-29-2012
Message 7 of 9 (9,082 Views)

# Re: Comma Separated Values

Hi Joseph,

Trusted Contributor
Posts: 115
Registered: ‎09-25-2006
Message 8 of 9 (9,056 Views)

# Re: Comma Separated Values

[ Edited ]

jc_cfa wrote:

Hi Joseph,

Ok, here's the program I described above.  Useful when a long integer or longfloat is on level 1; it displays it nicely formatted and screen-wrapped.

Important notes:  This program is for the HP 49g+/50g only.  Requires the LNViewer library freely downloadable HERE.  If you want to use its longfloat feature (longfloats are settable precision floating point numbers), then install the LongFloat library freely downloadable HERE. It also uses the SREV command from the built-in Library 256, so be sure to do 256 ATTACH before loading or typing the source code below. Once it's compiled, it'll run even if Library 256 isn't attached.

```\<< DUP
IF DUP TYPE 28. SAME
THEN \->STR SREV "," 3 STRD " "
SWAP + "
" -72 FS? 28 16 IFTE STRD TAIL
SREV
ELSE \->FNUM ZZ\<-\->F SWAP "E"
+ SWAP DIGITS 1 - + + DUP 1. 1.
SUB "." + SWAP 2. OVER SIZE SUB +
"
" -72 FS? 29 18 IFTE STRD
END
\>>```

BYTES: 244.0  #D67fh

Instructions: Assign it to a key. Press that key (in User mode, of course) to view any integer or longfloat on level 1, nicely formatted in string form. It DUPs the input, so you can just drop the string when you're done looking at it.

-Joe-

-Joe-