Use of Kilo, Mega,Tera in Plus42
05-13-2023, 11:11 AM
Post: #1
 nickapos Member Posts: 168 Joined: Sep 2021
Use of Kilo, Mega,Tera in Plus42
Hello everyone,
I wanted to ask if there is a standardised way I could use Kilo or Milli in Plus42 units.

Thank you very much
05-13-2023, 11:55 AM (This post was last modified: 05-13-2023 11:56 AM by jonmoore.)
Post: #2
 jonmoore Senior Member Posts: 311 Joined: Apr 2020
RE: Use of Kilo, Mega,Tera in Plus42
I'm not sure of the specifics of how the HP48GX approach to Units has been implemented by Thomas in Plus42, but the 48 has the UBASE command, which converts any Unit object on the stack to its SI base unit. From there you could create a simple program which you could trigger from your Plus42 user keyboard. Once you have your base SI unit, in most cases you simply need a factor of 10 to convert to your desired unit. e.g. 125_mm is 0.125_M in SI units.
05-13-2023, 12:01 PM (This post was last modified: 05-13-2023 12:26 PM by nickapos.)
Post: #3
 nickapos Member Posts: 168 Joined: Sep 2021
RE: Use of Kilo, Mega,Tera in Plus42
(05-13-2023 11:55 AM)jonmoore Wrote:  I'm not sure of the specifics of how the HP48GX approach to Units has been implemented by Thomas in Plus42, but the 48 has the UBASE command, which converts any Unit object on the stack to its SI base unit. From there you could create a simple program which you could trigger from your Plus42 user keyboard. Once you have your base SI unit, in most cases you simply need a factor of 10 to convert to your desired unit. e.g. 125_mm is 0.125_M in SI units.

Thank you very much John, I was looking at the code of Plus42 recently and I saw all the SI units mentioned in there, so I wondered if there is an easy way to do this. Right now I have created my own custom units so the conversion is easy, just wondered if I was missing a cool keystroke combo or anything.
05-13-2023, 01:40 PM (This post was last modified: 05-13-2023 01:43 PM by jonmoore.)
Post: #4
 jonmoore Senior Member Posts: 311 Joined: Apr 2020
RE: Use of Kilo, Mega,Tera in Plus42
As I understand things, Thomas based his implementation of Units in Plus42 on the 48's Units implementation.

To be specific, SI Base units aren't the metric system per se, they're the universals for time, length, mass etc. e.g. Much as mm is a metric unit, the SI unit of length is the meter (confusingly, denoted with a lowercase m by SI but with a capital M in HP calculators). The Ubase command converts any unit to its SI unit equivalent, which may not seem so useful on first look, but when you're chaining unit calculations, converting first to SI units ensures you're always calculating like units.

Symbol - Name - Quantity
s - second - time
m - metre - length
kg - kilogram - mass
A - ampere - electric current
K - kelvin - thermodynamic temperature
mol - mole - amount of substance
cd - candela - luminous intensity

Incidentally, I've just checked the Plus42 docs and Thomas has implemented the Ubase command. I don't know what platform you're using Plus42 on, so this next tip may or may not be so practical. On the 48 line of calculators you don't have to go through the the Unit's catalog to input units. You simply type an underscore and the symbol for the unit directly. e.g. 486_mm for millimeters or .486_M for meters.

Here's a link to the relevant section of the Plus42 docs: https://www.thomasokken.com/plus42/#units

However, those docs don't provide the fully skinny for working with units on the Plus 42. For that you'll need to refer to the HP48 series docs:

https://literature.hpcalc.org/items/375 - This is the User Guide and chapter 10 deals with Unit objects.

https://literature.hpcalc.org/items/370 - And this is the Advanced User Guide which has a very handy appendix (B) which shows native 48 units and their SI equivalent. It has to be remembered that vintage HP calculators where primarily designed for the US market, hence the default units in the table are US unit's (however, it's my understanding that internally the calculator uses the SI equivalent).
05-13-2023, 05:39 PM
Post: #5
 nickapos Member Posts: 168 Joined: Sep 2021
RE: Use of Kilo, Mega,Tera in Plus42
(05-13-2023 01:40 PM)jonmoore Wrote:  As I understand things, Thomas based his implementation of Units in Plus42 on the 48's Units implementation.

To be specific, SI Base units aren't the metric system per se, they're the universals for time, length, mass etc. e.g. Much as mm is a metric unit, the SI unit of length is the meter (confusingly, denoted with a lowercase m by SI but with a capital M in HP calculators). The Ubase command converts any unit to its SI unit equivalent, which may not seem so useful on first look, but when you're chaining unit calculations, converting first to SI units ensures you're always calculating like units.

Symbol - Name - Quantity
s - second - time
m - metre - length
kg - kilogram - mass
A - ampere - electric current
K - kelvin - thermodynamic temperature
mol - mole - amount of substance
cd - candela - luminous intensity

Incidentally, I've just checked the Plus42 docs and Thomas has implemented the Ubase command. I don't know what platform you're using Plus42 on, so this next tip may or may not be so practical. On the 48 line of calculators you don't have to go through the the Unit's catalog to input units. You simply type an underscore and the symbol for the unit directly. e.g. 486_mm for millimeters or .486_M for meters.

Here's a link to the relevant section of the Plus42 docs: https://www.thomasokken.com/plus42/#units

However, those docs don't provide the fully skinny for working with units on the Plus 42. For that you'll need to refer to the HP48 series docs:

https://literature.hpcalc.org/items/375 - This is the User Guide and chapter 10 deals with Unit objects.

https://literature.hpcalc.org/items/370 - And this is the Advanced User Guide which has a very handy appendix (B) which shows native 48 units and their SI equivalent. It has to be remembered that vintage HP calculators where primarily designed for the US market, hence the default units in the table are US unit's (however, it's my understanding that internally the calculator uses the SI equivalent).

Thank you very much for the details Jon
05-13-2023, 08:24 PM
Post: #6
 Marco Polo Member Posts: 279 Joined: Jun 2016
RE: Use of Kilo, Mega,Tera in Plus42
(05-13-2023 01:40 PM)jonmoore Wrote:  Incidentally, I've just checked the Plus42 docs and Thomas has implemented the Ubase command. I don't know what platform you're using Plus42 on, so this next tip may or may not be so practical. On the 48 line of calculators you don't have to go through the the Unit's catalog to input units. You simply type an underscore and the symbol for the unit directly. e.g. 486_mm for millimeters or .486_M for meters.
Just a quick correction.
On hp50 (and 48, i suppose), the symbol for meter is "m", not "M".
As a matter of fact any operation using "M" fails with errore "invalid unit"
05-13-2023, 10:57 PM
Post: #7
 BruceH Senior Member Posts: 514 Joined: Dec 2013
RE: Use of Kilo, Mega,Tera in Plus42
(05-13-2023 08:24 PM)Marco Polo Wrote:  As a matter of fact any operation using "M" fails with errore "invalid unit"

M is the prefix for Mega so it needs a unit to go with it.

e.g. (on the 48) 1_Mg 1_Kg + ENTER
-> 1001Kg
05-14-2023, 03:24 AM (This post was last modified: 05-14-2023 03:24 AM by nickapos.)
Post: #8
 nickapos Member Posts: 168 Joined: Sep 2021
RE: Use of Kilo, Mega,Tera in Plus42
Ok based on this last comment, it seems that the easiest way to convert between SI prefixes, for example between seconds and milliseconds is to type the SI prefix manually and then it seems to be working.

For example
1_s 1_ms + -> 1,001_ms

The SI prefix can be entered manually by hitting shift . For the underscore plus whatever letters needed.

Thanks everyone for helping with this
05-14-2023, 06:42 AM (This post was last modified: 05-14-2023 06:55 AM by jonmoore.)
Post: #9
 jonmoore Senior Member Posts: 311 Joined: Apr 2020
RE: Use of Kilo, Mega,Tera in Plus42
(05-13-2023 08:24 PM)Marco Polo Wrote:
(05-13-2023 01:40 PM)jonmoore Wrote:  Incidentally, I've just checked the Plus42 docs and Thomas has implemented the Ubase command. I don't know what platform you're using Plus42 on, so this next tip may or may not be so practical. On the 48 line of calculators you don't have to go through the the Unit's catalog to input units. You simply type an underscore and the symbol for the unit directly. e.g. 486_mm for millimeters or .486_M for meters.
Just a quick correction.
On hp50 (and 48, i suppose), the symbol for meter is "m", not "M".
As a matter of fact any operation using "M" fails with errore "invalid unit"

The information I've provided is correct for both 48GX and 50g as can be seen below:

Maybe Thomas altered things slightly for Plus42. But this seems unlikely, as he's always chosen HP UX conventions over modern conveniences in the past.

It must also be remembered that there are inconsistencies in the use of upper and lower case letters in the HP Units catalog due the the USA first aspect of HP Calculators - who new HP got there years before Donald J Trump (sorry couldn't resist being a Euro Socialist type!)

But there are many inconsistencies between SI conventions and the wider metric system from a lexigraphic perspective so "people in glass houses" and all that jazz.
05-14-2023, 11:00 AM
Post: #10
 Marco Polo Member Posts: 279 Joined: Jun 2016
RE: Use of Kilo, Mega,Tera in Plus42
(05-14-2023 06:42 AM)jonmoore Wrote:
(05-13-2023 08:24 PM)Marco Polo Wrote:  Just a quick correction.
On hp50 (and 48, i suppose), the symbol for meter is "m", not "M".
As a matter of fact any operation using "M" fails with errore "invalid unit"

The information I've provided is correct for both 48GX and 50g as can be seen below:

Maybe Thomas altered things slightly for Plus42. But this seems unlikely, as he's always chosen HP UX conventions over modern conveniences in the past.

It must also be remembered that there are inconsistencies in the use of upper and lower case letters in the HP Units catalog due the the USA first aspect of HP Calculators - who new HP got there years before Donald J Trump (sorry couldn't resist being a Euro Socialist type!)

But there are many inconsistencies between SI conventions and the wider metric system from a lexigraphic perspective so "people in glass houses" and all that jazz.
I see you are using microfont.
Microfont "M" and "m" are indentical, except size. So the "M" you are representing in your screenshot is actually a "m".
05-16-2023, 03:42 PM
Post: #11
 Dave Britten Senior Member Posts: 2,325 Joined: Dec 2013
RE: Use of Kilo, Mega,Tera in Plus42
If you just want something like Casio's engineering symbols (i.e. a different form of engineering display mode using alpha prefixes, with no attachment to any specific units), I wrote a program to do that a few years ago:

This allows doing all the same things you would on a Casio: entry and display of figures using engineering symbols (e.g. 2500k), and displaying a result converted to different symbol/mantissa (e.g. 2500k, 2.5M, 2500000, etc.).
05-17-2023, 01:55 AM
Post: #12
 jonmoore Senior Member Posts: 311 Joined: Apr 2020
RE: Use of Kilo, Mega,Tera in Plus42
(05-16-2023 03:42 PM)Dave Britten Wrote:  If you just want something like Casio's engineering symbols (i.e. a different form of engineering display mode using alpha prefixes, with no attachment to any specific units), I wrote a program to do that a few years ago:

This allows doing all the same things you would on a Casio: entry and display of figures using engineering symbols (e.g. 2500k), and displaying a result converted to different symbol/mantissa (e.g. 2500k, 2.5M, 2500000, etc.).

Very useful Dave. Ta muchly.
05-17-2023, 02:02 AM
Post: #13
 jonmoore Senior Member Posts: 311 Joined: Apr 2020
RE: Use of Kilo, Mega,Tera in Plus42
(05-14-2023 11:00 AM)Marco Polo Wrote:  I see you are using microfont.
Microfont "M" and "m" are indentical, except size. So the "M" you are representing in your screenshot is actually a "m".