Post Reply 
Syntax errors trying to use CONVERT
11-15-2014, 06:13 AM (This post was last modified: 11-15-2014 06:19 AM by mbeddo.)
Post: #1
Syntax errors trying to use CONVERT
I'm playing with my brand new HP Prime. I read a recent post about trouble using convert, so I thought I'd give it a go. Weirdness ... I want to convert 5 m to ft. Here's my steps:

1) on the entry line, type "CONVERT(5"
2) then Shift + space key (between decimal and + keys) - hoping to get an underscore character, but instead get "_(<box>)", where <box> is a small box character with blinking cursor.
3) go ahead and try to enter "m", hoping to get "CONVERT(5_m" but instead get "CONVERT(5_(m)". Anyway, I go ahead and finish
4) CONVERT(5_(m), 1_(ft)) gives syntax error.

I find that I have to use single quotes: CONVERT('5_m', '1_ft') to get 16.4041994751_ft

It seems if an underscore character follows a number, I get the box inside of parentheses where I'm to type the units character(s).

The only way I was able to type "CONVERT(5_m, 1_ft)" without single quotes was to enter the underscore and "m" FIRST, then back up to enter the "5", then enter the comma followed by another underscore and "ft" SECOND, then back up to enter the "1". Then it works.

Seems awkward.

- Mike

UPDATE: The above was my trying to do everything on the entry line. If instead I use the various units menus, entering "CONVERT(5" then Units->Length->m it pastes _(m) on the entry line, giving me "CONVERT(5_(m)" (which is what I originally tried but failed), and if I keep using menus instead of keys to complete the expression "CONVERT(5_(m), 1_(ft))" then it works!

Beats me.
Find all posts by this user
Quote this message in a reply
11-15-2014, 06:25 AM
Post: #2
RE: Syntax errors trying to use CONVERT
Well, I just tried it again using only keys but this time it worked! I still entered "CONVERT(5_(m), 1_(ft))" but after Enter it changed to "CONVERT(5_m, 1_ft)" in the history.

Sorry to have wasted anyone's time. I must have been too tired and screwed something up earlier when I tried.
Find all posts by this user
Quote this message in a reply
11-15-2014, 10:09 AM (This post was last modified: 11-15-2014 11:47 AM by DrD.)
Post: #3
RE: Syntax errors trying to use CONVERT
Trying your example:

In CAS mode, CONVERT(5_m, 1_ft), generates "Error: Unmatch control word"
convert(5_m, 1_ft) ---> 16.4041994751_(ft), So case matters.

In HOME mode, CONVERT(5_m, 1_ft) results in 16.4041994751_(ft), (depending on settings). convert(5_m, 1_ft) ---> 16.4041994751_(ft), So case doesn't matter.

There is no hint for this behavior in either On Calc help, or the User guide, and so this appears to be a bug.

-Dale-

EDIT: It has been pointed out that convert() is a CAS command, but CONVERT() is not. As such, it is not a CAS bug, but there is room for clarity in the documentation. In any event, depending on the mode used, results will vary. This is a likely cause for your experience.
Find all posts by this user
Quote this message in a reply
11-15-2014, 01:08 PM (This post was last modified: 11-15-2014 01:09 PM by Han.)
Post: #4
RE: Syntax errors trying to use CONVERT
(11-15-2014 06:13 AM)mbeddo Wrote:  I'm playing with my brand new HP Prime. I read a recent post about trouble using convert, so I thought I'd give it a go. Weirdness ... I want to convert 5 m to ft. Here's my steps:

1) on the entry line, type "CONVERT(5"
2) then Shift + space key (between decimal and + keys) - hoping to get an underscore character, but instead get "_(<box>)", where <box> is a small box character with blinking cursor.
3) go ahead and try to enter "m", hoping to get "CONVERT(5_m" but instead get "CONVERT(5_(m)". Anyway, I go ahead and finish
4) CONVERT(5_(m), 1_(ft)) gives syntax error.

I find that I have to use single quotes: CONVERT('5_m', '1_ft') to get 16.4041994751_ft

It seems if an underscore character follows a number, I get the box inside of parentheses where I'm to type the units character(s).

The only way I was able to type "CONVERT(5_m, 1_ft)" without single quotes was to enter the underscore and "m" FIRST, then back up to enter the "5", then enter the comma followed by another underscore and "ft" SECOND, then back up to enter the "1". Then it works.

Seems awkward.

- Mike

UPDATE: The above was my trying to do everything on the entry line. If instead I use the various units menus, entering "CONVERT(5" then Units->Length->m it pastes _(m) on the entry line, giving me "CONVERT(5_(m)" (which is what I originally tried but failed), and if I keep using menus instead of keys to complete the expression "CONVERT(5_(m), 1_(ft))" then it works!

Beats me.

Are you in RPN mode? Was this done in CAS?

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
11-15-2014, 02:04 PM
Post: #5
RE: Syntax errors trying to use CONVERT
(11-15-2014 06:13 AM)mbeddo Wrote:  It seems if an underscore character follows a number, I get the box inside of parentheses where I'm to type the units character(s).

The reason for this is so more complex units can be detected and used. If you notice on the 50g in RPN mode the instant you type a _ the entry mode gets dropped into algebraic mode. It stays in algebraic mode the rest of the entire entry. With the prime RPN mode one however, it only appies inside the _( ) region. You can thus directly type things like m/s^2 without issues.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
Post Reply 




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