02-21-2022, 05:18 AM
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
```
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