Invalid Input for this program

02212022, 05:18 AM
Post: #1




Invalid Input for this program
Ive been trying to add some functions to my calculator one of which is a quadratic solver. My code is:
``` EXPORT quadratic(A,B,C) BEGIN //Error: Pinpointed to be the  sign in the square root RETURN [(B+√((B^2)4*A*C))/(2*A),(B√((B^2)4*A*C))/(2*A)]; END; ``` It's quite simple but it fails. Checking the code, there are no syntax errors, but running it with quadratic(5,6,7) would give Error: Invalid input. I managed to debug and find the problem at the  sign under the square root. Any help would be appreciated 

02212022, 01:47 PM
Post: #2




RE: Invalid Input for this program
Press Shift Home (Settings), leftcursor twice, and then press [+] to turn on the option to "Allow complex output from real input". This will allow your Prime to calculate the square roots of negative values.
<0ɸ0> Joe 

02212022, 08:27 PM
Post: #3




RE: Invalid Input for this program
(02212022 01:47 PM)Joe Horn Wrote: Press Shift Home (Settings), leftcursor twice, and then press [+] to turn on the option to "Allow complex output from real input". This will allow your Prime to calculate the square roots of negative values. Thanks for the help. I had managed to actually fix my problem before this thread got approved by changing sqrt to CAS.sqrt which was able to solve the problem but I just now also enabled complex output as you mentioned. Thanks 

« Next Oldest  Next Newest »

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