09-16-2014, 07:09 PM (This post was last modified: 09-16-2014 08:10 PM by Han.)
Post: #1
 Han Senior Member Posts: 1,881 Joined: Dec 2013
Despite specifying a real-type only input variable, the editline insists on inserting single quotes around values. So when a user enters -3 it appears as '-3' on the editline. This of course leads into an invalid input error.

On top of that, the editline is then replaced with the topmost editline from the history -- but not the RPN history, it grabs it from the non-RPN home screen's history.

2 bugs in one... not exactly a bargain :-(

Edit: Looks like it is even worse than I thought.

Code:
EXPORT INEX() BEGIN   local xmin,xmax,ymin,ymax,zmin,zmax;   local zoom,tmode=1,wmode=1;   input(     {        {xmin,[0],{15,30,0}},       {xmax,[0],{65,30,0}},       {ymin,[0],{15,30,1}},       {ymax,[0],{65,30,1}},       {zmin,[0],{15,30,2}},       {zmax,[0],{65,30,2}},       {zoom,[0],{15,30,4}},       {tmode,0,{90,10,4}},       {wmode,0,{90,10,5}}     },     "Graph 3D Plot Setup",     {       "Xmin=", "Xmax=",       "Ymin=", "Ymax=",       "Zmin=", "Zmax=",       "Zoom=",       "Transparent?", "Show grid?"     },     {       "Enter the value of left side of the viewing box",       "Enter the value of right side of the viewing box",       "Enter the value of back side of the viewing box",       "Enter the value of front side of the viewing box",       "Enter the value of bottom side of the viewing box",       "Enter the value of top side of the viewing box",       "Enter the zoom factor (must be > 0)",       "Render surface with transparency?",       "Show wireframe?"     });   return({xmin,xmax,ymin,ymax,zmin,zmax,zoom,tmode,wmode}); END;

Now, enter in the values 3, 4, 5, 6, 7, 8, 9 and leave the two checkboxes checked. The output is: { 1, 1, 5, 6, 7, 8, 9, 0, 0 } -- THIS IS WRONG! Again use 3, 4, 5, 6, 7, 8, 9 and now leave the checkboxes unchecked! -- same output?! So the checkboxes do absolutely nothing!

I started to suspect the an off-by-one error tied to the line number of a field. So I moved tmode and wmode checkboxes to front of the varslist, and this is now the output: { 5, 6, 7, 8, 9, [0], [0], 3, 4} ?! Notice the [0]'s

There is yet ANOTHER bug with INPUT: if a variable is a choosebox type, and is not the last entry in the variables list, then the emulator crashes. If it doesn't crash, then the list is returned as the result, rather than the choice...

Long story short, DON'T USE THE ADVANCED FORM OF INPUT() in firmware 6030!

Graph 3D | QPI | SolveSys
09-17-2014, 01:36 PM
Post: #2
 toml_12953 Senior Member Posts: 1,775 Joined: Dec 2013
RE: [BUG] INPUT -- myriad bugs
(09-16-2014 07:09 PM)Han Wrote:  Now, enter in the values 3, 4, 5, 6, 7, 8, 9 and leave the two checkboxes checked. The output is: { 1, 1, 5, 6, 7, 8, 9, 0, 0 } -- THIS IS WRONG! Again use 3, 4, 5, 6, 7, 8, 9 and now leave the checkboxes unchecked! -- same output?! So the checkboxes do absolutely nothing!

With firmware 6031 the first example gives the same result. Unchecking the boxes results in

INEX {0, 0, 5, 6, 7, 8, 9, 0, 0} which is closer to correct!

Tom L

Tom L
Cui bono?
09-24-2014, 02:32 AM
Post: #3
 rafa22 Junior Member Posts: 1 Joined: Sep 2014
RE: [BUG] INPUT -- myriad bugs
export in5()
begin
// checkbox mods
local md,d,fcd,fyd,bw;
input({{md,1},{d,1},{fcd,1},{fyd,1},{bw,1}},"turn on variables");
input(md,"momento");
input(d,"trquinho");
input(fcd,"fcd");
input(fyd,"fyd");
input(bw,"bw");
A:=md/(d*(1-0.4*(1.25-sqrt(1.5624-md/(bw*d²*fcd)/0.272)))*fyd);
print();
print("Área de aço = ");
print(A);
end;