ENG button in Casio calculator - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: HP Prime Software Library (/forum-15.html) +--- Thread: ENG button in Casio calculator (/thread-5039.html) Pages: 1 2 ENG button in Casio calculator - cclinus - 10-30-2015 05:09 PM Hi, I like the ENG button in Casio calculator. It display number in engineering format and convert exponent(For example xxxE3 to xxxE6, xxxE6 to xxxE9 or reverse). HP prime seems do not have this button. So I make one for my HP prime. You may find that I use a dumb method to do the conversion. If you have better method, it is welcome to post it in this thread. Operation: 1)Key press: [Shift > User > * (Multiplication)] : exponent+3, E-12>E-9....E3>E6>E9>E12 2)Key press: [Shift > User > / (Division)] : exponent-3, E12>E9....E-3>E-6>E-9>E-12 3)Key press: [Shift > User > + (Addition)] : convert string back to number Screen shot: [attachment=2729] ENG program: Code: ``` EXPORT ENGA(x) BEGIN LOCAL pos,s,i,sign; IF TYPE(x)==0 THEN s:=STRING(x,4,11); WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; RETURN s; END; IF (TYPE(x)==2) AND (INSTRING(x,"ᴇ12")) THEN RETURN x; END; IF (TYPE(x)==2) AND (INSTRING(x,"ᴇ12")==0) THEN IF CHAR(x(1))=="−" THEN    sign:="−";    x:=RIGHT(x,DIM(x)-1); ELSE    sign:=""; END; s:=x; FOR i FROM 1 TO 3 DO pos:=INSTRING(s,"."); s(pos):=s(pos-1); s(pos-1):="."; IF pos==2 THEN s:="0"+s; END; END; WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; // s:=REPLACE(s,"ᴇ9","ᴇ12"); s:=REPLACE(s,"ᴇ6","ᴇ9"); s:=REPLACE(s,"ᴇ3","ᴇ6"); s:=REPLACE(s,"ᴇ0","ᴇ3"); s:=REPLACE(s,"ᴇ−3","ᴇ0"); s:=REPLACE(s,"ᴇ−6","ᴇ−3"); s:=REPLACE(s,"ᴇ−9","ᴇ−6"); s:=REPLACE(s,"ᴇ−12","ᴇ−9"); s:=sign+s; RETURN s; END; END; EXPORT ENGB(x) BEGIN LOCAL pos,s,i,sign; IF TYPE(x)==0 THEN s:=STRING(x,4,11); WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; RETURN s; END; IF TYPE(x)==2 AND (INSTRING(x,"ᴇ−12"))THEN RETURN x; END; IF TYPE(x)==2 AND (INSTRING(x,"ᴇ−12")==0)THEN IF CHAR(x(1))=="−" THEN    sign:="−";    x:=RIGHT(x,DIM(x)-1); ELSE    sign:=""; END; s:=x; FOR i FROM 1 TO 3 DO pos:=INSTRING(s,"."); IF s(pos+1)==7431 THEN s:=REPLACE(s,".ᴇ","0.ᴇ"); ELSE s(pos):=s(pos+1); s(pos+1):="."; IF (pos==2) AND (s(1)==48) THEN s:=RIGHT(s,DIM(s)-1); END; END; END; WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; // s:=REPLACE(s,"ᴇ−9","ᴇ−12"); s:=REPLACE(s,"ᴇ−6","ᴇ−9"); s:=REPLACE(s,"ᴇ−3","ᴇ−6"); s:=REPLACE(s,"ᴇ0","ᴇ−3"); s:=REPLACE(s,"ᴇ3","ᴇ0"); s:=REPLACE(s,"ᴇ6","ᴇ3"); s:=REPLACE(s,"ᴇ9","ᴇ6"); s:=REPLACE(s,"ᴇ12","ᴇ9"); s:=sign+s; RETURN s; END; END;``` User Defined key: Code: ``` KEY K_Mul() BEGIN RETURN "ENGA(Ans)"; END; KEY K_Div() BEGIN RETURN "ENGB(Ans)"; END; KEY K_Plus() BEGIN RETURN "EXPR(Ans)"; END;``` [attachment=2731] [attachment=3613] Last: Feature request for HP prime: 1) Need "press Enter" function in program. So that I don't need to press Enter after pressing user defined key. 2) Reverse HELP/USER key. So that [Shift] for HELP, normal for USER. This could reduce key stroke for user defined key. Please add this option in Setting mode. Thanks! EDITED:2016-JUN-9 Correct negative number bug. Delete the leading zeor. eg. 1.25000E0 => 1.25E0 RE: ENG button in Casio calculator - epp - 10-30-2015 07:46 PM How is this different from setting Number Format to Engineering, or setting variable HFormat to 3? RE: ENG button in Casio calculator - cclinus - 10-31-2015 02:02 AM Hi, First, I don't want the calculator to display every number in engineering format. I just want it to display Eng format when I need. Second, you don't need to set it back to standard format after use. Third, for example, 0.001, the calculator is always display "1E-3" in Eng format. But , sometimes, I want it display in "1000E-6". That's why I need ENG button. Thanks! RE: ENG button in Casio calculator - Dieter - 10-31-2015 06:59 AM (10-30-2015 05:09 PM)cclinus Wrote:  I like the ENG button in Casio calculator. It display number in engineering format and convert exponent(For example xxxE3 to xxxE6, xxxE6 to xxxE9 or reverse). For the record: this is not a Casio-exclusive feature. For instance, the 35s also has two ←ENG and ENG→ buttons for a temporary ENG display while the user can switch up and down through the exponents. Dieter RE: ENG button in Casio calculator - salvomic - 04-23-2016 09:02 PM ok, thank you. However I need something like this to toggle between prefixes (a,f,p,n,µ,m ... k,M,G,T,P,E) example: I have 0.135 and I would like to toggle: 135 m, 135000 µ, 135000000 n ... or I have 135000 and I would like to toggle 135 k, 0.135 M and so on... This purpose having or not having regard to the unit of measure (i.e. V, F, ohm...), like in some Casio calc (with the ←ENG and ENG→ buttons)... I mean to toggle back and forward from any number in a simple way (like with user keystrokes)... Any idea? Salvo RE: ENG button in Casio calculator - Steve Simpkin - 04-23-2016 10:52 PM (10-31-2015 06:59 AM)Dieter Wrote:  For the record: this is not a Casio-exclusive feature. For instance, the 35s also has two ←ENG and ENG→ buttons for a temporary ENG display while the user can switch up and down through the exponents. Dieter So did the Commodore SR4148R from 1976! http://www.wass.net/manuals/jpg/Commodore%20SR4148R.jpg RE: ENG button in Casio calculator - salvomic - 04-25-2016 09:03 AM hi cclinus, I propose to you a variation to expand ENG values between E-24 and E24 and introducing a way to get also prefixes (m,µ,n,p... M,G,T...) instead of ENG (using user key -). The program can be ameliorated and please, let me know what you think about (also other users, please, contribute)... Salvo main prog Code: ``` // Program to toggle between  ←ENG and ENG→ // define keys / * + (toggle_eng_float) reeng(); EXPORT ENGA(x) BEGIN LOCAL pos,s,i; IF TYPE(x)==0 THEN RETURN STRING(x,4,11); END; IF (TYPE(x)==2) THEN   IF (INSTRING(x," ")) THEN x:= reeng(x); END; END; IF (TYPE(x)==2) AND (INSTRING(x,"ᴇ24")) THEN RETURN x; END; IF (TYPE(x)==2) AND (INSTRING(x,"ᴇ24")==0) THEN s:=x; FOR i FROM 1 TO 3 DO pos:=INSTRING(s,"."); s(pos):=s(pos-1); s(pos-1):="."; IF pos==2 THEN s:="0"+s; END; END; WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; // s:=REPLACE(s,"ᴇ21","ᴇ24"); s:=REPLACE(s,"ᴇ18","ᴇ21"); s:=REPLACE(s,"ᴇ15","ᴇ18"); s:=REPLACE(s,"ᴇ12","ᴇ15"); s:=REPLACE(s,"ᴇ9","ᴇ12"); s:=REPLACE(s,"ᴇ6","ᴇ9"); s:=REPLACE(s,"ᴇ3","ᴇ6"); s:=REPLACE(s,"ᴇ0","ᴇ3"); s:=REPLACE(s,"ᴇ−3","ᴇ0"); s:=REPLACE(s,"ᴇ−6","ᴇ−3"); s:=REPLACE(s,"ᴇ−9","ᴇ−6"); s:=REPLACE(s,"ᴇ−12","ᴇ−9"); s:=REPLACE(s,"ᴇ−15","ᴇ−12"); s:=REPLACE(s,"ᴇ−18","ᴇ−15"); s:=REPLACE(s,"ᴇ−21","ᴇ−18"); s:=REPLACE(s,"ᴇ−24","ᴇ−21"); RETURN s; END; END; EXPORT ENGB(x) BEGIN LOCAL pos,s,i; IF TYPE(x)==0 THEN RETURN STRING(x,4,11); END; IF (TYPE(x)==2) THEN   IF (INSTRING(x," ")) THEN x:= reeng(x); END; END; IF TYPE(x)==2 AND (INSTRING(x,"ᴇ−24"))THEN RETURN x; END; IF TYPE(x)==2 AND (INSTRING(x,"ᴇ−24")==0)THEN s:=x; FOR i FROM 1 TO 3 DO pos:=INSTRING(s,"."); IF s(pos+1)==7431 THEN s:=REPLACE(s,".ᴇ","0.ᴇ"); ELSE s(pos):=s(pos+1); s(pos+1):="."; IF (pos==2) AND (s(1)==48) THEN s:=RIGHT(s,DIM(s)-1); END; END; END; WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; // s:=REPLACE(s,"ᴇ−21","ᴇ−24"); s:=REPLACE(s,"ᴇ−18","ᴇ−21"); s:=REPLACE(s,"ᴇ−15","ᴇ−18"); s:=REPLACE(s,"ᴇ−12","ᴇ−15"); s:=REPLACE(s,"ᴇ−9","ᴇ−12"); s:=REPLACE(s,"ᴇ−6","ᴇ−9"); s:=REPLACE(s,"ᴇ−3","ᴇ−6"); s:=REPLACE(s,"ᴇ0","ᴇ−3"); s:=REPLACE(s,"ᴇ3","ᴇ0"); s:=REPLACE(s,"ᴇ6","ᴇ3"); s:=REPLACE(s,"ᴇ9","ᴇ6"); s:=REPLACE(s,"ᴇ12","ᴇ9"); s:=REPLACE(s,"ᴇ15","ᴇ12"); s:=REPLACE(s,"ᴇ18","ᴇ15"); s:=REPLACE(s,"ᴇ21","ᴇ18"); s:=REPLACE(s,"ᴇ24","ᴇ21"); RETURN s; END; END; EXPORT prefix(s) BEGIN LOCAL t; IF TYPE(s)==0 THEN t:= STRING(s,4,11); ELSE t:= s; END; t:=REPLACE(t,"ᴇ−24"," y"); t:=REPLACE(t,"ᴇ−21"," z"); t:=REPLACE(t,"ᴇ−18"," a"); t:=REPLACE(t,"ᴇ−15"," f"); t:=REPLACE(t,"ᴇ−12"," p"); t:=REPLACE(t,"ᴇ−9"," n"); t:=REPLACE(t,"ᴇ−6"," μ"); t:=REPLACE(t,"ᴇ−3"," m"); t:=REPLACE(t,"ᴇ3"," k"); t:=REPLACE(t,"ᴇ6"," M"); t:=REPLACE(t,"ᴇ9"," G"); t:=REPLACE(t,"ᴇ12"," T"); t:=REPLACE(t,"ᴇ15"," P"); t:=REPLACE(t,"ᴇ18"," E"); t:=REPLACE(t,"ᴇ21"," Z"); t:=REPLACE(t,"ᴇ24"," Y"); RETURN t; END; EXPORT reeng(s) BEGIN LOCAL t; IF TYPE(s)==0 THEN t:= STRING(s,4,11); ELSE t:= s; END; t:=REPLACE(t," y","ᴇ−24"); t:=REPLACE(t," z","ᴇ−21"); t:=REPLACE(t," a","ᴇ−18"); t:=REPLACE(t," f","ᴇ−15"); t:=REPLACE(t," p","ᴇ−12"); t:=REPLACE(t," n","ᴇ−9"); t:=REPLACE(t," μ","ᴇ−6"); t:=REPLACE(t," m","ᴇ−3"); t:=REPLACE(t," k","ᴇ3"); t:=REPLACE(t," M","ᴇ6"); t:=REPLACE(t," G","ᴇ9"); t:=REPLACE(t," T","ᴇ12"); t:=REPLACE(t," P","ᴇ15"); t:=REPLACE(t," E","ᴇ18"); t:=REPLACE(t," Z","ᴇ21"); t:=REPLACE(t," Y","ᴇ24"); RETURN t; END;``` key definition (toggle: shift-Help + key) Code: ``` // this require ENGA(), ENGB(), prefix(), reeng() in a program KEY K_Mul() BEGIN RETURN "ENGA(Ans)"; END; KEY K_Div() BEGIN RETURN "ENGB(Ans)"; END; KEY K_Plus() BEGIN RETURN "EXPR(reeng(Ans))"; END; KEY K_Minus() BEGIN RETURN "prefix(Ans)"; END;``` ... This code need to be modified in three ways: 1. deleting the leading zeroes at the end, i.e. "1.2530000000E9" should be "1.253E9" without zeroes... 2. avoiding to have ENGA(Ans), ENGB(Ans) and prefix(Ans): for a real "ENG key" simulation it would be better don't show them 3. implementing back and forward also for prefixes like in ←ENG and ENG→ of the (modified) original program (if one want to have both systems ENG and prefixes) RE: ENG button in Casio calculator - salvomic - 05-11-2016 01:27 PM Maybe it would need a correction for negative values :-) Input -2.1972 ENGA(Ans) -> "-2.1972...E0" ENGA(Ans) -> "0.0-21972...E-3" (I'm using my version as above) Salvo RE: ENG button in Casio calculator - cclinus - 06-05-2016 11:33 AM Hi Salvo, Thanks for your comments. The bug for negative number is corrected. File and code are updated in first post. Regards! RE: ENG button in Casio calculator - salvomic - 06-06-2016 04:05 PM (06-05-2016 11:33 AM)cclinus Wrote:  Hi Salvo, Thanks for your comments. The bug for negative number is corrected. File and code are updated in first post. Regards! thank you! I'll try soon. Salvo RE: ENG button in Casio calculator - salvomic - 06-06-2016 08:31 PM hi, here there is my "extended" (to E24) version (with also prefixes) and your function for the sign... It should work (but, please, try). With this one you can use ÷, X and + keys also... Code: ``` // Program to toggle between  ←ENG and ENG→ // define keys / * + (toggle_eng_float) reeng(); EXPORT ENGA(x) BEGIN LOCAL pos,s,i, sign; IF TYPE(x)==0 THEN RETURN STRING(x,4,11); END; IF (TYPE(x)==2) THEN   IF (INSTRING(x," ")) THEN x:= reeng(x); END; END; IF (TYPE(x)==2) AND (INSTRING(x,"ᴇ24")) THEN RETURN x; END; IF (TYPE(x)==2) AND (INSTRING(x,"ᴇ24")==0) THEN IF CHAR(x(1))=="−" THEN    sign:="−";    x:=RIGHT(x,DIM(x)-1); ELSE    sign:=""; END; s:=x; FOR i FROM 1 TO 3 DO pos:=INSTRING(s,"."); s(pos):=s(pos-1); s(pos-1):="."; IF pos==2 THEN s:="0"+s; END; END; WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; // s:=REPLACE(s,"ᴇ21","ᴇ24"); s:=REPLACE(s,"ᴇ18","ᴇ21"); s:=REPLACE(s,"ᴇ15","ᴇ18"); s:=REPLACE(s,"ᴇ12","ᴇ15"); s:=REPLACE(s,"ᴇ9","ᴇ12"); s:=REPLACE(s,"ᴇ6","ᴇ9"); s:=REPLACE(s,"ᴇ3","ᴇ6"); s:=REPLACE(s,"ᴇ0","ᴇ3"); s:=REPLACE(s,"ᴇ−3","ᴇ0"); s:=REPLACE(s,"ᴇ−6","ᴇ−3"); s:=REPLACE(s,"ᴇ−9","ᴇ−6"); s:=REPLACE(s,"ᴇ−12","ᴇ−9"); s:=REPLACE(s,"ᴇ−15","ᴇ−12"); s:=REPLACE(s,"ᴇ−18","ᴇ−15"); s:=REPLACE(s,"ᴇ−21","ᴇ−18"); s:=REPLACE(s,"ᴇ−24","ᴇ−21"); s:=sign+s; RETURN s; END; END; EXPORT ENGB(x) BEGIN LOCAL pos,s,i, sign; IF TYPE(x)==0 THEN RETURN STRING(x,4,11); END; IF (TYPE(x)==2) THEN   IF (INSTRING(x," ")) THEN x:= reeng(x); END; END; IF TYPE(x)==2 AND (INSTRING(x,"ᴇ−24"))THEN RETURN x; END; IF TYPE(x)==2 AND (INSTRING(x,"ᴇ−24")==0)THEN IF CHAR(x(1))=="−" THEN    sign:="−";    x:=RIGHT(x,DIM(x)-1); ELSE    sign:=""; END; s:=x; FOR i FROM 1 TO 3 DO pos:=INSTRING(s,"."); IF s(pos+1)==7431 THEN s:=REPLACE(s,".ᴇ","0.ᴇ"); ELSE s(pos):=s(pos+1); s(pos+1):="."; IF (pos==2) AND (s(1)==48) THEN s:=RIGHT(s,DIM(s)-1); END; END; END; WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; // s:=REPLACE(s,"ᴇ−21","ᴇ−24"); s:=REPLACE(s,"ᴇ−18","ᴇ−21"); s:=REPLACE(s,"ᴇ−15","ᴇ−18"); s:=REPLACE(s,"ᴇ−12","ᴇ−15"); s:=REPLACE(s,"ᴇ−9","ᴇ−12"); s:=REPLACE(s,"ᴇ−6","ᴇ−9"); s:=REPLACE(s,"ᴇ−3","ᴇ−6"); s:=REPLACE(s,"ᴇ0","ᴇ−3"); s:=REPLACE(s,"ᴇ3","ᴇ0"); s:=REPLACE(s,"ᴇ6","ᴇ3"); s:=REPLACE(s,"ᴇ9","ᴇ6"); s:=REPLACE(s,"ᴇ12","ᴇ9"); s:=REPLACE(s,"ᴇ15","ᴇ12"); s:=REPLACE(s,"ᴇ18","ᴇ15"); s:=REPLACE(s,"ᴇ21","ᴇ18"); s:=REPLACE(s,"ᴇ24","ᴇ21"); s:=sign+s; RETURN s; END; END; EXPORT prefix(s) BEGIN LOCAL t; IF TYPE(s)==0 THEN t:= STRING(s,4,11); ELSE t:= s; END; t:=REPLACE(t,"ᴇ−24"," y"); t:=REPLACE(t,"ᴇ−21"," z"); t:=REPLACE(t,"ᴇ−18"," a"); t:=REPLACE(t,"ᴇ−15"," f"); t:=REPLACE(t,"ᴇ−12"," p"); t:=REPLACE(t,"ᴇ−9"," n"); t:=REPLACE(t,"ᴇ−6"," μ"); t:=REPLACE(t,"ᴇ−3"," m"); t:=REPLACE(t,"ᴇ3"," k"); t:=REPLACE(t,"ᴇ6"," M"); t:=REPLACE(t,"ᴇ9"," G"); t:=REPLACE(t,"ᴇ12"," T"); t:=REPLACE(t,"ᴇ15"," P"); t:=REPLACE(t,"ᴇ18"," E"); t:=REPLACE(t,"ᴇ21"," Z"); t:=REPLACE(t,"ᴇ24"," Y"); RETURN t; END; EXPORT reeng(s) BEGIN LOCAL t; IF TYPE(s)==0 THEN t:= STRING(s,4,11); ELSE t:= s; END; t:=REPLACE(t," y","ᴇ−24"); t:=REPLACE(t," z","ᴇ−21"); t:=REPLACE(t," a","ᴇ−18"); t:=REPLACE(t," f","ᴇ−15"); t:=REPLACE(t," p","ᴇ−12"); t:=REPLACE(t," n","ᴇ−9"); t:=REPLACE(t," μ","ᴇ−6"); t:=REPLACE(t," m","ᴇ−3"); t:=REPLACE(t," k","ᴇ3"); t:=REPLACE(t," M","ᴇ6"); t:=REPLACE(t," G","ᴇ9"); t:=REPLACE(t," T","ᴇ12"); t:=REPLACE(t," P","ᴇ15"); t:=REPLACE(t," E","ᴇ18"); t:=REPLACE(t," Z","ᴇ21"); t:=REPLACE(t," Y","ᴇ24"); RETURN t; END;``` RE: ENG button in Casio calculator - cclinus - 06-09-2016 05:57 AM Hi Salvo, The following codes are used to delete the leading zero. eg. 1.250000E0 => 1.25E0 =================== LOCAL pos,s,i,sign; IF TYPE(x)==0 THEN s:=STRING(x,4,11); WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; RETURN s; END; =================== Do you find any problem or bug about these code? I noticed that you didn't add these code into your program. Thanks! RE: ENG button in Casio calculator - salvomic - 06-09-2016 01:11 PM hi thank you, Sorry, I had "mis-copied" and forgot to insert the code. Now it's ok! Below the complete code. Salvo Code: ``` // Program to toggle between  ←ENG and ENG→ // define keys / * + (toggle_eng_float) reeng(); EXPORT ENGA(x) BEGIN LOCAL pos,s,i, sign; IF TYPE(x)==0 THEN s:=STRING(x,4,11); WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; RETURN s; END; IF (TYPE(x)==2) THEN   IF (INSTRING(x," ")) THEN x:= reeng(x); END; END; IF (TYPE(x)==2) AND (INSTRING(x,"ᴇ24")) THEN RETURN x; END; IF (TYPE(x)==2) AND (INSTRING(x,"ᴇ24")==0) THEN IF CHAR(x(1))=="−" THEN    sign:="−";    x:=RIGHT(x,DIM(x)-1); ELSE    sign:=""; END; s:=x; FOR i FROM 1 TO 3 DO pos:=INSTRING(s,"."); s(pos):=s(pos-1); s(pos-1):="."; IF pos==2 THEN s:="0"+s; END; END; WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; // s:=REPLACE(s,"ᴇ21","ᴇ24"); s:=REPLACE(s,"ᴇ18","ᴇ21"); s:=REPLACE(s,"ᴇ15","ᴇ18"); s:=REPLACE(s,"ᴇ12","ᴇ15"); s:=REPLACE(s,"ᴇ9","ᴇ12"); s:=REPLACE(s,"ᴇ6","ᴇ9"); s:=REPLACE(s,"ᴇ3","ᴇ6"); s:=REPLACE(s,"ᴇ0","ᴇ3"); s:=REPLACE(s,"ᴇ−3","ᴇ0"); s:=REPLACE(s,"ᴇ−6","ᴇ−3"); s:=REPLACE(s,"ᴇ−9","ᴇ−6"); s:=REPLACE(s,"ᴇ−12","ᴇ−9"); s:=REPLACE(s,"ᴇ−15","ᴇ−12"); s:=REPLACE(s,"ᴇ−18","ᴇ−15"); s:=REPLACE(s,"ᴇ−21","ᴇ−18"); s:=REPLACE(s,"ᴇ−24","ᴇ−21"); s:=sign+s; RETURN s; END; END; EXPORT ENGB(x) BEGIN LOCAL pos,s,i, sign; IF TYPE(x)==0 THEN s:=STRING(x,4,11); WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; RETURN s; END; IF (TYPE(x)==2) THEN   IF (INSTRING(x," ")) THEN x:= reeng(x); END; END; IF TYPE(x)==2 AND (INSTRING(x,"ᴇ−24"))THEN RETURN x; END; IF TYPE(x)==2 AND (INSTRING(x,"ᴇ−24")==0)THEN IF CHAR(x(1))=="−" THEN    sign:="−";    x:=RIGHT(x,DIM(x)-1); ELSE    sign:=""; END; s:=x; FOR i FROM 1 TO 3 DO pos:=INSTRING(s,"."); IF s(pos+1)==7431 THEN s:=REPLACE(s,".ᴇ","0.ᴇ"); ELSE s(pos):=s(pos+1); s(pos+1):="."; IF (pos==2) AND (s(1)==48) THEN s:=RIGHT(s,DIM(s)-1); END; END; END; WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; // s:=REPLACE(s,"ᴇ−21","ᴇ−24"); s:=REPLACE(s,"ᴇ−18","ᴇ−21"); s:=REPLACE(s,"ᴇ−15","ᴇ−18"); s:=REPLACE(s,"ᴇ−12","ᴇ−15"); s:=REPLACE(s,"ᴇ−9","ᴇ−12"); s:=REPLACE(s,"ᴇ−6","ᴇ−9"); s:=REPLACE(s,"ᴇ−3","ᴇ−6"); s:=REPLACE(s,"ᴇ0","ᴇ−3"); s:=REPLACE(s,"ᴇ3","ᴇ0"); s:=REPLACE(s,"ᴇ6","ᴇ3"); s:=REPLACE(s,"ᴇ9","ᴇ6"); s:=REPLACE(s,"ᴇ12","ᴇ9"); s:=REPLACE(s,"ᴇ15","ᴇ12"); s:=REPLACE(s,"ᴇ18","ᴇ15"); s:=REPLACE(s,"ᴇ21","ᴇ18"); s:=REPLACE(s,"ᴇ24","ᴇ21"); s:=sign+s; RETURN s; END; END; EXPORT prefix(s) BEGIN LOCAL t; IF TYPE(s)==0 THEN t:= STRING(s,4,11); ELSE t:= s; END; t:=REPLACE(t,"ᴇ−24"," y"); t:=REPLACE(t,"ᴇ−21"," z"); t:=REPLACE(t,"ᴇ−18"," a"); t:=REPLACE(t,"ᴇ−15"," f"); t:=REPLACE(t,"ᴇ−12"," p"); t:=REPLACE(t,"ᴇ−9"," n"); t:=REPLACE(t,"ᴇ−6"," μ"); t:=REPLACE(t,"ᴇ−3"," m"); t:=REPLACE(t,"ᴇ3"," k"); t:=REPLACE(t,"ᴇ6"," M"); t:=REPLACE(t,"ᴇ9"," G"); t:=REPLACE(t,"ᴇ12"," T"); t:=REPLACE(t,"ᴇ15"," P"); t:=REPLACE(t,"ᴇ18"," E"); t:=REPLACE(t,"ᴇ21"," Z"); t:=REPLACE(t,"ᴇ24"," Y"); RETURN t; END; EXPORT reeng(s) BEGIN LOCAL t; IF TYPE(s)==0 THEN t:= STRING(s,4,11); ELSE t:= s; END; t:=REPLACE(t," y","ᴇ−24"); t:=REPLACE(t," z","ᴇ−21"); t:=REPLACE(t," a","ᴇ−18"); t:=REPLACE(t," f","ᴇ−15"); t:=REPLACE(t," p","ᴇ−12"); t:=REPLACE(t," n","ᴇ−9"); t:=REPLACE(t," μ","ᴇ−6"); t:=REPLACE(t," m","ᴇ−3"); t:=REPLACE(t," k","ᴇ3"); t:=REPLACE(t," M","ᴇ6"); t:=REPLACE(t," G","ᴇ9"); t:=REPLACE(t," T","ᴇ12"); t:=REPLACE(t," P","ᴇ15"); t:=REPLACE(t," E","ᴇ18"); t:=REPLACE(t," Z","ᴇ21"); t:=REPLACE(t," Y","ᴇ24"); RETURN t; END;``` RE: ENG button in Casio calculator - tlmachado - 06-21-2017 01:12 PM NICE! TKS!! RE: ENG button in Casio calculator - alan966 - 10-12-2017 01:03 AM So i installed the program but i got a syntax error in the ENG program. Line 3. The cursor goes to the "s" LOCAL pos,s,sing; My firmware version: 2017 07 10 (12066) RE: ENG button in Casio calculator - ww63 - 10-12-2017 02:35 PM Insert the pragma line at the beginning. It looks like a problem with the ',' RE: ENG button in Casio calculator - alan966 - 10-12-2017 02:47 PM (10-12-2017 02:35 PM)ww63 Wrote:  Insert the pragma line at the beginning. It looks like a problem with the ',' Can you show me how the program will looks like ? I am not familiar with programming RE: ENG button in Casio calculator - alan966 - 10-13-2017 01:48 AM Problem solved. The problem really was with the ",". Since i live in Brazil we use the "," as decimal separator too. The pragma worked, but without any other corrections in the program the answers got "." and "," all out of place. So i changed my numerical format back to "." as decimal separator and so far soo good RE: ENG button in Casio calculator - salvomic - 12-12-2017 05:45 PM A new version that should eliminate all leading zeros in ENGA(), ENGB() and prefix(). It remains always the comma first of the E symbol, but it shouldn't be a problem, as the number can be returned again using reeng(). Thanks to cclinus for the original program! The code: Code: ``` // Program to toggle between  ←ENG and ENG→ // define keys / * + (toggle_eng_float) reeng(); EXPORT ENGA(x) BEGIN LOCAL pos,s,i; IF TYPE(x)==0 THEN RETURN STRING(x,4,11); END; IF (TYPE(x)==2) THEN   IF (INSTRING(x," ")) THEN x:= reeng(x); END; END; IF (TYPE(x)==2) AND (INSTRING(x,"ᴇ24")) THEN RETURN x; END; IF (TYPE(x)==2) AND (INSTRING(x,"ᴇ24")==0) THEN s:=x; FOR i FROM 1 TO 3 DO pos:=INSTRING(s,"."); s(pos):=s(pos-1); s(pos-1):="."; IF pos==2 THEN s:="0"+s; END; END; WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; // s:=REPLACE(s,"ᴇ21","ᴇ24"); s:=REPLACE(s,"ᴇ18","ᴇ21"); s:=REPLACE(s,"ᴇ15","ᴇ18"); s:=REPLACE(s,"ᴇ12","ᴇ15"); s:=REPLACE(s,"ᴇ9","ᴇ12"); s:=REPLACE(s,"ᴇ6","ᴇ9"); s:=REPLACE(s,"ᴇ3","ᴇ6"); s:=REPLACE(s,"ᴇ0","ᴇ3"); s:=REPLACE(s,"ᴇ−3","ᴇ0"); s:=REPLACE(s,"ᴇ−6","ᴇ−3"); s:=REPLACE(s,"ᴇ−9","ᴇ−6"); s:=REPLACE(s,"ᴇ−12","ᴇ−9"); s:=REPLACE(s,"ᴇ−15","ᴇ−12"); s:=REPLACE(s,"ᴇ−18","ᴇ−15"); s:=REPLACE(s,"ᴇ−21","ᴇ−18"); s:=REPLACE(s,"ᴇ−24","ᴇ−21"); RETURN s; END; END; EXPORT ENGB(x) BEGIN LOCAL pos,s,i,t; IF TYPE(x)==0 THEN t:=STRING(x,4,11); WHILE INSTRING(t,"0ᴇ") DO t:=REPLACE(t,"0ᴇ","ᴇ") END; RETURN t; END; IF (TYPE(x)==2) THEN   IF (INSTRING(x," ")) THEN x:= reeng(x); END; END; IF TYPE(x)==2 AND (INSTRING(x,"ᴇ−24"))THEN RETURN x; END; IF TYPE(x)==2 AND (INSTRING(x,"ᴇ−24")==0)THEN s:=x; FOR i FROM 1 TO 3 DO pos:=INSTRING(s,"."); IF s(pos+1)==7431 THEN s:=REPLACE(s,".ᴇ","0.ᴇ"); ELSE s(pos):=s(pos+1); s(pos+1):="."; IF (pos==2) AND (s(1)==48) THEN s:=RIGHT(s,DIM(s)-1); END; END; WHILE INSTRING(s,"0ᴇ") DO s:=REPLACE(s,"0ᴇ","ᴇ") END; END; // s:=REPLACE(s,"ᴇ−21","ᴇ−24"); s:=REPLACE(s,"ᴇ−18","ᴇ−21"); s:=REPLACE(s,"ᴇ−15","ᴇ−18"); s:=REPLACE(s,"ᴇ−12","ᴇ−15"); s:=REPLACE(s,"ᴇ−9","ᴇ−12"); s:=REPLACE(s,"ᴇ−6","ᴇ−9"); s:=REPLACE(s,"ᴇ−3","ᴇ−6"); s:=REPLACE(s,"ᴇ0","ᴇ−3"); s:=REPLACE(s,"ᴇ3","ᴇ0"); s:=REPLACE(s,"ᴇ6","ᴇ3"); s:=REPLACE(s,"ᴇ9","ᴇ6"); s:=REPLACE(s,"ᴇ12","ᴇ9"); s:=REPLACE(s,"ᴇ15","ᴇ12"); s:=REPLACE(s,"ᴇ18","ᴇ15"); s:=REPLACE(s,"ᴇ21","ᴇ18"); s:=REPLACE(s,"ᴇ24","ᴇ21"); RETURN s; END; END; EXPORT prefix(s) BEGIN LOCAL t; IF TYPE(s)==0 THEN t:= STRING(s,4,11); ELSE t:= s; END; WHILE INSTRING(t,"0ᴇ") DO t:=REPLACE(t,"0ᴇ","ᴇ") END; t:=REPLACE(t,"ᴇ−24"," y"); t:=REPLACE(t,"ᴇ−21"," z"); t:=REPLACE(t,"ᴇ−18"," a"); t:=REPLACE(t,"ᴇ−15"," f"); t:=REPLACE(t,"ᴇ−12"," p"); t:=REPLACE(t,"ᴇ−9"," n"); t:=REPLACE(t,"ᴇ−6"," μ"); t:=REPLACE(t,"ᴇ−3"," m"); t:=REPLACE(t,"ᴇ0",""); t:=REPLACE(t,"ᴇ3"," k"); t:=REPLACE(t,"ᴇ6"," M"); t:=REPLACE(t,"ᴇ9"," G"); t:=REPLACE(t,"ᴇ12"," T"); t:=REPLACE(t,"ᴇ15"," P"); t:=REPLACE(t,"ᴇ18"," E"); t:=REPLACE(t,"ᴇ21"," Z"); t:=REPLACE(t,"ᴇ24"," Y"); RETURN t; END; EXPORT reeng(s) BEGIN LOCAL t; IF TYPE(s)==0 THEN t:= STRING(s,4,11); ELSE t:= s; END; t:=REPLACE(t," y","ᴇ−24"); t:=REPLACE(t," z","ᴇ−21"); t:=REPLACE(t," a","ᴇ−18"); t:=REPLACE(t," f","ᴇ−15"); t:=REPLACE(t," p","ᴇ−12"); t:=REPLACE(t," n","ᴇ−9"); t:=REPLACE(t," μ","ᴇ−6"); t:=REPLACE(t," m","ᴇ−3"); t:=REPLACE(t," k","ᴇ3"); t:=REPLACE(t," M","ᴇ6"); t:=REPLACE(t," G","ᴇ9"); t:=REPLACE(t," T","ᴇ12"); t:=REPLACE(t," P","ᴇ15"); t:=REPLACE(t," E","ᴇ18"); t:=REPLACE(t," Z","ᴇ21"); t:=REPLACE(t," Y","ᴇ24"); RETURN t; END;``` The key definition to use the program: Use Shift-Help (User) and ÷ ENGB() x ENGA() - prefix() + reeng() Code: ``` // this require ENGA(), ENGB(), prefix(), reeng() in a program KEY K_Mul() BEGIN RETURN "ENGA(Ans)"; END; KEY K_Div() BEGIN RETURN "ENGB(Ans)"; END; KEY K_Plus() BEGIN RETURN "EXPR(reeng(Ans))"; END; KEY K_Minus() BEGIN RETURN "prefix(Ans)"; END;``` A code to toggle from and to ENG format (key 1: shift-Help 1): Code: ``` KEY K_1() // use Shift Help 1 // HFormat: 0 standard, 1 fixed, 2 scientific, 3 engineering // 4 floating, 5 rounded BEGIN  if HFormat == 0 then   HFormat:=3;  else   HFormat:=0;  end;  return ""; END;``` Enjoy! Salvo RE: ENG button in Casio calculator - BERNARD MICHAUD - 01-07-2018 01:49 AM Hi Salvo I am interested in this program, but I noticed that in the program KEY K_1() the latest Firmware has added new options in the Number Format: section and it seems that now 0=System, 1=Standard, 2=Fixed, 3= Scientific, 4=Engineering, 5=Floating, and 6=Rounded. Just wondering if that would affect the KEY K_1() part of the program in Post 19 (bottom). Also it would help to have an example as to how to run the program to achieve the proper result. It may prompt more users to download and use it. Thanks Bernard