The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Possible bug with polar_coordinates
07-03-2018, 04:10 AM
Post: #1
Possible bug with polar_coordinates
Today I spent some time chasing down a very unexpected result with polar_coordinates command that I by chance encountered. I don't think this whatever is causing it is necessarily limited to this command. I have a little program to demonstrate this:

Code:
EXPORT IFERR_polar()
BEGIN
  LOCAL m;
  RECT_P();
  TEXTOUT_P("Press Any Key",G0,0,0,3);
  REPEAT
    IFERR m:=WAIT(-1); THEN
      m:=4;
    ELSE
    END;
  UNTIL TYPE(m)==0 OR IFTE(SIZE(m)>1,m(1)==3,0);
  MSGBOX(polar_coordinates({30,20}));
  MSGBOX("Still running");
END;

Try running the program and:
  1. When prompted, press any key other than the On key
  2. When prompted, press the On Key


What is happening here?
  1. When the user presses any key other then the On key, then the IFERR trap doesn't have an error to trap, the polar_coordinates calculation returns the expected result, and the "Still running" message box confirms the program is still running.
  2. When the user presses the On key, then the IFERR trap does have an error to trap, the polar_coordinates calculation returns a bizarre error even though the program is still running as proven by the following "Still running" message box.


If I replace the polar_coordinates command with a user-defined function, then there is no problem so I can get around this by just using my own code for the calculation, however I'm more curious if someone has an explanation for this?
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Possible bug with polar_coordinates - Jacob Wall - 07-03-2018 04:10 AM



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