UP | HOME

free42 Custom Unit Conversion Factors

Author: Mitch Richling
Updated: 2021-10-27 19:00:58

Copyright 2021 Mitch Richling. All rights reserved.

Table of Contents

1. Metadata

The home for this HTML file is: https://richmit.github.io/hp42/unit.html

A PDF version of this file may be found here: https://richmit.github.io/hp42/unit.pdf

Files related to this document may be found on github: https://github.com/richmit/hp42

Directory contents:

src - The org-mode file that generated this HTML document
src_42s - Ready to convert source listings for 42s code in this document
docs - This html document and associated PDF
bin - Importable RAW program files

2. Introduction

This application has a few unit conversions for temperatures; however, the focus is on a nice way to organize and recall various conversion factors I frequently use. That is to say, I don't really want to convert "in" to "cm", instead I want to push the conversion factor to the stack.

Aside from the TEMP menu, all of the menus have the same structure. The first menu key is the "base" unit for that page. Pressing any menu key will push a conversion factor for the given unit to the "base" unit to the stack. For example, if the left most menu is "mm" then pressing the "in" button will push 25.4 to the stack – the value you would multiply by to convert from inches to millimeters or divide by to convert from millimeters to inches.

Some constants are little programs. In some cases these are derived conversion factors, and the programs make that explicit. More importantly in cases when the base conversion factors are exact quantities, the programs insure we obtain machine accuracy – i.e. 1/2.54 is better than 0.3937.

3. Units

3.1. Conversion Factors

Type Conversion Description ……….
Leng:mm 1.0  
Leng:Ang 1e-7 Angstrom
Leng:μm 0.001 Micron
Leng:mil FUNC 01; 25.4; 1000; ÷ mil (1/1000 in)
Leng:cm 10  
Leng:in 25.4 Inch
Leng:in 1  
Leng:hand 4  
Leng:ft 12  
Leng:yd FUNC 01; 3; 12; ×  
Leng:fathom FUNC 01; 6; 12; ×  
Leng:mile FUNC 01; 5280; 12; ×  
Leng:km 1  
Leng:mi FUNC 01; 2.54; 12; ×; 5280; ×; 1e5; ÷ Int Mile
Leng:us mi 1.60934721869 US Mile
Leng:nmi 1.852 Int Nautical mi
Leng:m 0.001  
Leng:ft FUNC 01; 2.54; 12; ×; 1e5; ÷ Intl Foot
Area:hectare 1 hectare
Area:acre 0.40468564224 Int Acre
Area:m^2 0.0001  
Area:yd^2 8.36127360001e-5  
Vol:l 1  
Vol:qt 0.946352946 US Lq Quart
Vol:gal FUNC 01; 0.946352946; 4; × US Lq Gal
Vol:cc 0.001  
Vol:butt FUNC 01; 0.946352946; 4; ×; 126; × US Butt 126 US Gal
Vol:bbutt FUNC 01; 4.54609; 108; × UK Butt 108 UK Gal
Vol:tsp 1 Teaspoon
Vol:tbsp 3 Tablespoon
Vol:flOZ 6 fl oz
Vol:cup 48 Cup
Vol:pint 96 Pint
Vol:qt 192 Quart
Time:sec 1  
Time:min 60  
Time:hour 3600  
Time:day 86400  
Time:week 604800  
Time:year 31536000 365 day year
Time:day 1  
Time:year 365 Conentional
Time:acnt 360 Accounting
Time:greg 365.2425 Mean Gregorian
Time:julian 365.25  
Time:astro 365.256363004 Astronomical
Mass:kg 1  
Mass:lb 0.45359237 Pound Int
Mass:g 1e3  
Mass:ozWT 28e3 Ounce Food Weight
Mass:ozTr 31.1034768e3 Ounce Troy
Mass:stone FUNC 01; 0.45359237; 14; × Int Stone
Mass:lb 1  
Mass:US ton 2000 US (short) Ton
Mass:UK ton 2240 UK (long) Ton
Force:N 1  
Force:kgf 9.80665  
Force:lbf FUNC 01; 0.45359237; 9.80665; × Int lbf
Sped:m/s 1  
Sped:mph FUNC 01; 2.54; 12; ×; 5280; ×; 1e2; ÷; 3600; ÷ Int mph
Sped:kph FUNC 01; 1000; 3600; ÷  
Sped:knot FUNC 01; 1.852; 1000; ×; 3600; ÷ Intl nmi
Pres:Pa 1 N/m^2
Pres:bar 100000  
Pres:psi FUNC 01; 1e4; 0.45359237; ×; 9.80665; ×; 2.54; X^2; ÷  
Pres:atm 101325 Standard
Pres:mmHg 133.322  
Pres:inHg 3.386389e3 Conventional
Powr:watt 1  
Powr:BTU/h 0.2930710702 International
Powr:hp 735.49875 Metric
Powr:kcal/h 1.163  
Temp:C→F FUNC 11; 9; ×; 5; ÷; 32; +  
Temp:F→C FUNC 11; 32; -; 5; ×; 9; ÷  
Temp:K→C FUNC 11; 273.15; -  
Temp:C→K FUNC 11; 273.15; +  
▒▒▒▒    
SIPFX Run the SIPFX application  

3.2. Code

(MJR-generate-42-menu-code "UNIT" 
                           0
                           tbl
                           0
                           nil
                           'stay ;; Change to 'exit to exit immediatly after a conversion factor is pushed to the stack
                           'up   ;; Change to 'exit to have the application exit when [EXIT] is pressed
                           'yes
                           (lambda (atrg row) (if (string-equal "SIPFX" atrg) (format "\"%s\"" atrg)))
                           ;;#'MJR-local-only-gen-lab
                           (lambda (atrg target row) 
                             (cl-destructuring-bind (menu cfactor desc) row
                               (let ((print-desc 't))    ;; Set to NIL to not print description
                                 (let* ((dlen (length desc))
                                        (dsc1 (if (> dlen 0)
                                                  (substring desc 0 (min dlen 15))))
                                        (dsc2 (if (> dlen 14)
                                                  (substring desc 15 (min dlen 22)))))
                                   (mapconcat #'string-trim-left 
                                              (cl-remove nil (flatten-list
                                                              (list (split-string (message "%s" cfactor) ";")
                                                                    (and print-desc dsc1 (message "\"%s\"" dsc1))
                                                                    (and print-desc dsc2 (message "├\"%s\"" dsc2))
                                                                    (and print-desc (or dsc1 dsc2) "AVIEW"))))
                                              "\n"))))))
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ (UNIT)
@@@@ DSC: Auto-generated menu program
LBL "UNIT"
LBL 01            @@@@ Page 1 of menu UNIT
CLMENU
"Leng"
KEY 1 GTO 03
"Area"
KEY 2 GTO 04
"Vol"
KEY 3 GTO 05
"Time"
KEY 4 GTO 06
"Mass"
KEY 5 GTO 07
"Force"
KEY 6 GTO 08
KEY 7 GTO 02
KEY 8 GTO 02
KEY 9 GTO 00
MENU
STOP
GTO 01
LBL 02            @@@@ Page 2 of menu UNIT
CLMENU
"Sped"
KEY 1 GTO 09
"Pres"
KEY 2 GTO 10
"Powr"
KEY 3 GTO 11
"Temp"
KEY 4 GTO 12
"SIPFX"
KEY 6 XEQ "SIPFX"
KEY 7 GTO 01
KEY 8 GTO 01
KEY 9 GTO 00
MENU
STOP
GTO 02
LBL 03            @@@@ Page 1 of menu Leng
CLMENU
"mm"
KEY 1 XEQ 15
"Ang"
KEY 2 XEQ 16
"μm"
KEY 3 XEQ 17
"mil"
KEY 4 XEQ 18
"cm"
KEY 5 XEQ 19
"in"
KEY 6 XEQ 20
KEY 7 GTO 14
KEY 8 GTO 13
KEY 9 GTO 01
MENU
STOP
GTO 03
LBL 13            @@@@ Page 2 of menu Leng
CLMENU
"in"
KEY 1 XEQ 21
"hand"
KEY 2 XEQ 22
"ft"
KEY 3 XEQ 23
"yd"
KEY 4 XEQ 24
"fathom"
KEY 5 XEQ 25
"mile"
KEY 6 XEQ 26
KEY 7 GTO 03
KEY 8 GTO 14
KEY 9 GTO 01
MENU
STOP
GTO 13
LBL 14            @@@@ Page 3 of menu Leng
CLMENU
"km"
KEY 1 XEQ 27
"mi"
KEY 2 XEQ 28
"us mi"
KEY 3 XEQ 29
"nmi"
KEY 4 XEQ 30
"m"
KEY 5 XEQ 31
"ft"
KEY 6 XEQ 32
KEY 7 GTO 13
KEY 8 GTO 03
KEY 9 GTO 01
MENU
STOP
GTO 14
LBL 04            @@@@ Page 1 of menu Area
CLMENU
"hectare"
KEY 1 XEQ 33
"acre"
KEY 2 XEQ 34
"m^2"
KEY 3 XEQ 35
"yd^2"
KEY 4 XEQ 36
KEY 9 GTO 01
MENU
STOP
GTO 04
LBL 05            @@@@ Page 1 of menu Vol
CLMENU
"l"
KEY 1 XEQ 38
"qt"
KEY 2 XEQ 39
"gal"
KEY 3 XEQ 40
"cc"
KEY 4 XEQ 41
"butt"
KEY 5 XEQ 42
"bbutt"
KEY 6 XEQ 43
KEY 7 GTO 37
KEY 8 GTO 37
KEY 9 GTO 01
MENU
STOP
GTO 05
LBL 37            @@@@ Page 2 of menu Vol
CLMENU
"tsp"
KEY 1 XEQ 44
"tbsp"
KEY 2 XEQ 45
"flOZ"
KEY 3 XEQ 46
"cup"
KEY 4 XEQ 47
"pint"
KEY 5 XEQ 48
"qt"
KEY 6 XEQ 49
KEY 7 GTO 05
KEY 8 GTO 05
KEY 9 GTO 01
MENU
STOP
GTO 37
LBL 06            @@@@ Page 1 of menu Time
CLMENU
"sec"
KEY 1 XEQ 51
"min"
KEY 2 XEQ 52
"hour"
KEY 3 XEQ 53
"day"
KEY 4 XEQ 54
"week"
KEY 5 XEQ 55
"year"
KEY 6 XEQ 56
KEY 7 GTO 50
KEY 8 GTO 50
KEY 9 GTO 01
MENU
STOP
GTO 06
LBL 50            @@@@ Page 2 of menu Time
CLMENU
"day"
KEY 1 XEQ 57
"year"
KEY 2 XEQ 58
"acnt"
KEY 3 XEQ 59
"greg"
KEY 4 XEQ 60
"julian"
KEY 5 XEQ 61
"astro"
KEY 6 XEQ 62
KEY 7 GTO 06
KEY 8 GTO 06
KEY 9 GTO 01
MENU
STOP
GTO 50
LBL 07            @@@@ Page 1 of menu Mass
CLMENU
"kg"
KEY 1 XEQ 64
"lb"
KEY 2 XEQ 65
"g"
KEY 3 XEQ 66
"ozWT"
KEY 4 XEQ 67
"ozTr"
KEY 5 XEQ 68
"stone"
KEY 6 XEQ 69
KEY 7 GTO 63
KEY 8 GTO 63
KEY 9 GTO 01
MENU
STOP
GTO 07
LBL 63            @@@@ Page 2 of menu Mass
CLMENU
"lb"
KEY 1 XEQ 70
"US ton"
KEY 2 XEQ 71
"UK ton"
KEY 3 XEQ 72
KEY 7 GTO 07
KEY 8 GTO 07
KEY 9 GTO 01
MENU
STOP
GTO 63
LBL 08            @@@@ Page 1 of menu Force
CLMENU
"N"
KEY 1 XEQ 73
"kgf"
KEY 2 XEQ 74
"lbf"
KEY 3 XEQ 75
KEY 9 GTO 01
MENU
STOP
GTO 08
LBL 09            @@@@ Page 1 of menu Sped
CLMENU
"m/s"
KEY 1 XEQ 76
"mph"
KEY 2 XEQ 77
"kph"
KEY 3 XEQ 78
"knot"
KEY 4 XEQ 79
KEY 9 GTO 02
MENU
STOP
GTO 09
LBL 10            @@@@ Page 1 of menu Pres
CLMENU
"Pa"
KEY 1 XEQ 80
"bar"
KEY 2 XEQ 81
"psi"
KEY 3 XEQ 82
"atm"
KEY 4 XEQ 83
"mmHg"
KEY 5 XEQ 84
"inHg"
KEY 6 XEQ 85
KEY 9 GTO 02
MENU
STOP
GTO 10
LBL 11            @@@@ Page 1 of menu Powr
CLMENU
"watt"
KEY 1 XEQ 86
"BTU/h"
KEY 2 XEQ 87
"hp"
KEY 3 XEQ 88
"kcal/h"
KEY 4 XEQ 89
KEY 9 GTO 02
MENU
STOP
GTO 11
LBL 12            @@@@ Page 1 of menu Temp
CLMENU
"C→F"
KEY 1 XEQ 90
"F→C"
KEY 2 XEQ 91
"K→C"
KEY 3 XEQ 92
"C→K"
KEY 4 XEQ 93
KEY 9 GTO 02
MENU
STOP
GTO 12
LBL 00 @@@@ Application Exit
EXITALL
RTN
LBL 15    @@@@ Action for menu key mm
1.0
RTN
LBL 16    @@@@ Action for menu key Ang
1e-07
"Angstrom"
AVIEW
RTN
LBL 17    @@@@ Action for menu key μm
0.001
"Micron"
AVIEW
RTN
LBL 18    @@@@ Action for menu key mil
FUNC 01
25.4
1000
÷
"mil (1/1000 in)"
""
AVIEW
RTN
LBL 19    @@@@ Action for menu key cm
10
RTN
LBL 20    @@@@ Action for menu key in
25.4
"Inch"
AVIEW
RTN
LBL 21    @@@@ Action for menu key in
1
RTN
LBL 22    @@@@ Action for menu key hand
4
RTN
LBL 23    @@@@ Action for menu key ft
12
RTN
LBL 24    @@@@ Action for menu key yd
FUNC 01
3
12
×
RTN
LBL 25    @@@@ Action for menu key fathom
FUNC 01
6
12
×
RTN
LBL 26    @@@@ Action for menu key mile
FUNC 01
5280
12
×
RTN
LBL 27    @@@@ Action for menu key km
1
RTN
LBL 28    @@@@ Action for menu key mi
FUNC 01
2.54
12
×
5280
×
1e5
÷
"Int Mile"
AVIEW
RTN
LBL 29    @@@@ Action for menu key us mi
1.60934721869
"US Mile"
AVIEW
RTN
LBL 30    @@@@ Action for menu key nmi
1.852
"Int Nautical mi"
""
AVIEW
RTN
LBL 31    @@@@ Action for menu key m
0.001
RTN
LBL 32    @@@@ Action for menu key ft
FUNC 01
2.54
12
×
1e5
÷
"Intl Foot"
AVIEW
RTN
LBL 33    @@@@ Action for menu key hectare
1
"hectare"
AVIEW
RTN
LBL 34    @@@@ Action for menu key acre
0.40468564224
"Int Acre"
AVIEW
RTN
LBL 35    @@@@ Action for menu key m^2
0.0001
RTN
LBL 36    @@@@ Action for menu key yd^2
8.36127360001e-05
RTN
LBL 38    @@@@ Action for menu key l
1
RTN
LBL 39    @@@@ Action for menu key qt
0.946352946
"US Lq Quart"
AVIEW
RTN
LBL 40    @@@@ Action for menu key gal
FUNC 01
0.946352946
4
×
"US Lq Gal"
AVIEW
RTN
LBL 41    @@@@ Action for menu key cc
0.001
RTN
LBL 42    @@@@ Action for menu key butt
FUNC 01
0.946352946
4
×
126
×
"US Butt 126 US "
"Gal"
AVIEW
RTN
LBL 43    @@@@ Action for menu key bbutt
FUNC 01
4.54609
108
×
"UK Butt 108 UK "
"Gal"
AVIEW
RTN
LBL 44    @@@@ Action for menu key tsp
1
"Teaspoon"
AVIEW
RTN
LBL 45    @@@@ Action for menu key tbsp
3
"Tablespoon"
AVIEW
RTN
LBL 46    @@@@ Action for menu key flOZ
6
"fl oz"
AVIEW
RTN
LBL 47    @@@@ Action for menu key cup
48
"Cup"
AVIEW
RTN
LBL 48    @@@@ Action for menu key pint
96
"Pint"
AVIEW
RTN
LBL 49    @@@@ Action for menu key qt
192
"Quart"
AVIEW
RTN
LBL 51    @@@@ Action for menu key sec
1
RTN
LBL 52    @@@@ Action for menu key min
60
RTN
LBL 53    @@@@ Action for menu key hour
3600
RTN
LBL 54    @@@@ Action for menu key day
86400
RTN
LBL 55    @@@@ Action for menu key week
604800
RTN
LBL 56    @@@@ Action for menu key year
31536000
"365 day year"
AVIEW
RTN
LBL 57    @@@@ Action for menu key day
1
RTN
LBL 58    @@@@ Action for menu key year
365
"Conentional"
AVIEW
RTN
LBL 59    @@@@ Action for menu key acnt
360
"Accounting"
AVIEW
RTN
LBL 60    @@@@ Action for menu key greg
365.2425
"Mean Gregorian"
AVIEW
RTN
LBL 61    @@@@ Action for menu key julian
365.25
RTN
LBL 62    @@@@ Action for menu key astro
365.256363004
"Astronomical"
AVIEW
RTN
LBL 64    @@@@ Action for menu key kg
1
RTN
LBL 65    @@@@ Action for menu key lb
0.45359237
"Pound Int"
AVIEW
RTN
LBL 66    @@@@ Action for menu key g
1000.0
RTN
LBL 67    @@@@ Action for menu key ozWT
28000.0
"Ounce Food Weig"
"ht"
AVIEW
RTN
LBL 68    @@@@ Action for menu key ozTr
31103.4768
"Ounce Troy"
AVIEW
RTN
LBL 69    @@@@ Action for menu key stone
FUNC 01
0.45359237
14
×
"Int Stone"
AVIEW
RTN
LBL 70    @@@@ Action for menu key lb
1
RTN
LBL 71    @@@@ Action for menu key US ton
2000
"US (short) Ton"
AVIEW
RTN
LBL 72    @@@@ Action for menu key UK ton
2240
"UK (long) Ton"
AVIEW
RTN
LBL 73    @@@@ Action for menu key N
1
RTN
LBL 74    @@@@ Action for menu key kgf
9.80665
RTN
LBL 75    @@@@ Action for menu key lbf
FUNC 01
0.45359237
9.80665
×
"Int lbf"
AVIEW
RTN
LBL 76    @@@@ Action for menu key m/s
1
RTN
LBL 77    @@@@ Action for menu key mph
FUNC 01
2.54
12
×
5280
×
1e2
÷
3600
÷
"Int mph"
AVIEW
RTN
LBL 78    @@@@ Action for menu key kph
FUNC 01
1000
3600
÷
RTN
LBL 79    @@@@ Action for menu key knot
FUNC 01
1.852
1000
×
3600
÷
"Intl nmi"
AVIEW
RTN
LBL 80    @@@@ Action for menu key Pa
1
"N/m^2"
AVIEW
RTN
LBL 81    @@@@ Action for menu key bar
100000
RTN
LBL 82    @@@@ Action for menu key psi
FUNC 01
1e4
0.45359237
×
9.80665
×
2.54
X^2
÷
RTN
LBL 83    @@@@ Action for menu key atm
101325
"Standard"
AVIEW
RTN
LBL 84    @@@@ Action for menu key mmHg
133.322
RTN
LBL 85    @@@@ Action for menu key inHg
3386.389
"Conventional"
AVIEW
RTN
LBL 86    @@@@ Action for menu key watt
1
RTN
LBL 87    @@@@ Action for menu key BTU/h
0.2930710702
"International"
AVIEW
RTN
LBL 88    @@@@ Action for menu key hp
735.49875
"Metric"
AVIEW
RTN
LBL 89    @@@@ Action for menu key kcal/h
1.163
RTN
LBL 90    @@@@ Action for menu key C→F
FUNC 11
9
×
5
÷
32
+
RTN
LBL 91    @@@@ Action for menu key F→C
FUNC 11
32
-
5
×
9
÷
RTN
LBL 92    @@@@ Action for menu key K→C
FUNC 11
273.15
-
RTN
LBL 93    @@@@ Action for menu key C→K
FUNC 11
273.15
+
RTN
@@@@ Free labels start at: 94
END

4. SI Prefixes

4.1. Generic

4.1.1. Menu

Prefix Sym Val
centi c 1e-2
milli m 1e-3
micro µ 1e-6
nano n 1e-9
pico p 1e-12
femto f 1e-15
kilo k 1e+3
mega M 1e+6
giga G 1e+9
tera T 1e+12
peta P 1e+15
exa E 1e+18
kibi Ki 1024
mebi Mi 1048576
gibi Gi 1073741824
tebi Ti 1099511627776
pebi Pi 1125899906842624
exbi Ei 1152921504606846976

Normally pressing the menu key will multiply the X value on the stack by the prefix multiplayer. If [SHIFT] is pressed befreo the menu key, then X will be divided by the prefix mulitplyer.

4.1.2. Menu Code

Note: This one will have an END generated to finish the UNIT application.

(MJR-generate-42-menu-code "SIPFX" 
                           0
                           tbl
                           0
                           nil
                           'stay ;; Change to 'exit to exit immediatly after a conversion factor is pushed to the stack
                           'up   ;; Change to 'exit to have the application exit when [EXIT] is pressed
                           'no
                           #'MJR-local-only-gen-lab
                           (lambda (atrg target row) 
                            (cl-destructuring-bind (prefix-str sym-string mult) row
                              (mapconcat #'string-trim-left 
                                         (list (format "%s" mult)
                                               (format "FS? 64")
                                               (format "÷")
                                               (format "FC? 64")
                                               (format "×")
                                               (format "\"%s (%s)\"" prefix-str sym-string)
                                               ;;(format "AVIEW")
                                               )
                                         "\n"))))
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ (SIPFX)
@@@@ DSC: Auto-generated menu program
LBL "SIPFX"
LBL 01            @@@@ Page 1 of menu SIPFX
CLMENU
"centi"
KEY 1 XEQ 04
"milli"
KEY 2 XEQ 05
"micro"
KEY 3 XEQ 06
"nano"
KEY 4 XEQ 07
"pico"
KEY 5 XEQ 08
"femto"
KEY 6 XEQ 09
KEY 7 GTO 03
KEY 8 GTO 02
KEY 9 GTO 00
MENU
STOP
GTO 01
LBL 02            @@@@ Page 2 of menu SIPFX
CLMENU
"kilo"
KEY 1 XEQ 10
"mega"
KEY 2 XEQ 11
"giga"
KEY 3 XEQ 12
"tera"
KEY 4 XEQ 13
"peta"
KEY 5 XEQ 14
"exa"
KEY 6 XEQ 15
KEY 7 GTO 01
KEY 8 GTO 03
KEY 9 GTO 00
MENU
STOP
GTO 02
LBL 03            @@@@ Page 3 of menu SIPFX
CLMENU
"kibi"
KEY 1 XEQ 16
"mebi"
KEY 2 XEQ 17
"gibi"
KEY 3 XEQ 18
"tebi"
KEY 4 XEQ 19
"pebi"
KEY 5 XEQ 20
"exbi"
KEY 6 XEQ 21
KEY 7 GTO 02
KEY 8 GTO 01
KEY 9 GTO 00
MENU
STOP
GTO 03
LBL 00 @@@@ Application Exit
EXITALL
RTN
LBL 04    @@@@ Action for menu key centi
0.01
FS? 64
÷
FC? 64
×
"centi (c)"
RTN
LBL 05    @@@@ Action for menu key milli
0.001
FS? 64
÷
FC? 64
×
"milli (m)"
RTN
LBL 06    @@@@ Action for menu key micro
1e-06
FS? 64
÷
FC? 64
×
"micro (µ)"
RTN
LBL 07    @@@@ Action for menu key nano
1e-09
FS? 64
÷
FC? 64
×
"nano (n)"
RTN
LBL 08    @@@@ Action for menu key pico
1e-12
FS? 64
÷
FC? 64
×
"pico (p)"
RTN
LBL 09    @@@@ Action for menu key femto
1e-15
FS? 64
÷
FC? 64
×
"femto (f)"
RTN
LBL 10    @@@@ Action for menu key kilo
1000.0
FS? 64
÷
FC? 64
×
"kilo (k)"
RTN
LBL 11    @@@@ Action for menu key mega
1000000.0
FS? 64
÷
FC? 64
×
"mega (M)"
RTN
LBL 12    @@@@ Action for menu key giga
1000000000.0
FS? 64
÷
FC? 64
×
"giga (G)"
RTN
LBL 13    @@@@ Action for menu key tera
1000000000000.0
FS? 64
÷
FC? 64
×
"tera (T)"
RTN
LBL 14    @@@@ Action for menu key peta
1e+15
FS? 64
÷
FC? 64
×
"peta (P)"
RTN
LBL 15    @@@@ Action for menu key exa
1e+18
FS? 64
÷
FC? 64
×
"exa (E)"
RTN
LBL 16    @@@@ Action for menu key kibi
1024
FS? 64
÷
FC? 64
×
"kibi (Ki)"
RTN
LBL 17    @@@@ Action for menu key mebi
1048576
FS? 64
÷
FC? 64
×
"mebi (Mi)"
RTN
LBL 18    @@@@ Action for menu key gibi
1073741824
FS? 64
÷
FC? 64
×
"gibi (Gi)"
RTN
LBL 19    @@@@ Action for menu key tebi
1099511627776
FS? 64
÷
FC? 64
×
"tebi (Ti)"
RTN
LBL 20    @@@@ Action for menu key pebi
1125899906842624
FS? 64
÷
FC? 64
×
"pebi (Pi)"
RTN
LBL 21    @@@@ Action for menu key exbi
1152921504606846976
FS? 64
÷
FC? 64
×
"exbi (Ei)"
RTN
@@@@ Free labels start at: 22

4.2. EE Prefixes

For EE problems a smaller set of prefixes is more efficient

4.2.1. Menu

Prefix Sym Val
micro µ 1e-6
nano n 1e-9
pico p 1e-12
▒▒▒▒    
kilo k 1e+3
mega M 1e+6

4.2.2. Menu Code

(MJR-generate-42-menu-code "EEPFX" 
                           30
                           tbl
                           0
                           nil
                           'stay ;; Change to 'exit to exit immediatly after a conversion factor is pushed to the stack
                           'up   ;; Change to 'exit to have the application exit when [EXIT] is pressed
                           'yes
                           #'MJR-local-only-gen-lab
                           (lambda (atrg target row) 
                            (cl-destructuring-bind (prefix-str sym-string mult) row
                              (mapconcat #'string-trim-left 
                                         (list (format "%s" mult)
                                               (format "FS? 64")
                                               (format "÷")
                                               (format "FC? 64")
                                               (format "×"))
                                         "\n"))))
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ (EEPFX)
@@@@ DSC: Auto-generated menu program
LBL "EEPFX"
LBL 31            @@@@ Page 1 of menu EEPFX
CLMENU
"micro"
KEY 1 XEQ 32
"nano"
KEY 2 XEQ 33
"pico"
KEY 3 XEQ 34
"kilo"
KEY 5 XEQ 35
"mega"
KEY 6 XEQ 36
KEY 9 GTO 30
MENU
STOP
GTO 31
LBL 30 @@@@ Application Exit
EXITALL
RTN
LBL 32    @@@@ Action for menu key micro
1e-06
FS? 64
÷
FC? 64
×
RTN
LBL 33    @@@@ Action for menu key nano
1e-09
FS? 64
÷
FC? 64
×
RTN
LBL 34    @@@@ Action for menu key pico
1e-12
FS? 64
÷
FC? 64
×
RTN
LBL 35    @@@@ Action for menu key kilo
1000.0
FS? 64
÷
FC? 64
×
RTN
LBL 36    @@@@ Action for menu key mega
1000000.0
FS? 64
÷
FC? 64
×
RTN
@@@@ Free labels start at: 37
END

5. EOF
































































































Created by Mitch Richling <http://www.mitchr.me/>. Rendered on 2021-10-27 Wed 19:06 via Emacs 27.2 (Org mode 9.4.6)